forked from Wavyzz/dolibarr
Compare commits
392 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7f7f5bf3d | ||
|
|
7c0a6946a7 | ||
|
|
1ecc1afa9e | ||
|
|
ceb1e699b7 | ||
|
|
c028819cab | ||
|
|
d59b1bb0c6 | ||
|
|
9d582a53ca | ||
|
|
8eac45a762 | ||
|
|
3d85407619 | ||
|
|
ca1e3b4d55 | ||
|
|
94bb1ac511 | ||
|
|
8893d8d59f | ||
|
|
5bab9d59b2 | ||
|
|
e41b55af13 | ||
|
|
a69c3caf2c | ||
|
|
e03d7eba8c | ||
|
|
2aa0956f15 | ||
|
|
bb09bcece4 | ||
|
|
94de6efa4b | ||
|
|
dd208348c4 | ||
|
|
c0e719e3d8 | ||
|
|
5adeaf9d76 | ||
|
|
9253fed754 | ||
|
|
8000777864 | ||
|
|
e4725f4248 | ||
|
|
6de3a40546 | ||
|
|
c90ece1188 | ||
|
|
c7d0e917fb | ||
|
|
42b7d80567 | ||
|
|
141df52dd6 | ||
|
|
01a3787664 | ||
|
|
783efd1a71 | ||
|
|
9178d80349 | ||
|
|
bc8127d685 | ||
|
|
9bcf01bf3f | ||
|
|
fed0f3d09e | ||
|
|
c387436a68 | ||
|
|
8ac7dd8e9a | ||
|
|
75580f253e | ||
|
|
3793ae323a | ||
|
|
ef61407d95 | ||
|
|
5776a948c4 | ||
|
|
72108c3a4e | ||
|
|
e61bcd03ed | ||
|
|
3295498e9e | ||
|
|
e9912c020e | ||
|
|
7c743eb7da | ||
|
|
6701ad8b73 | ||
|
|
5a75e14a8a | ||
|
|
f5e14c9d70 | ||
|
|
237270a27e | ||
|
|
67b5353861 | ||
|
|
4dd58a94f3 | ||
|
|
1821be87e9 | ||
|
|
1154f871f1 | ||
|
|
eb9e8c9dfc | ||
|
|
ac7f1035e1 | ||
|
|
9fe1d8462a | ||
|
|
cf49c274a6 | ||
|
|
1a956cce9a | ||
|
|
256f6e410c | ||
|
|
d5d337c631 | ||
|
|
71818da6a5 | ||
|
|
c53aef9955 | ||
|
|
a18995d3dc | ||
|
|
112a6f7b44 | ||
|
|
9ad2a9ac85 | ||
|
|
2a59dbbc89 | ||
|
|
ca3cdfabec | ||
|
|
bfa8630feb | ||
|
|
0bf4ac6fb3 | ||
|
|
2be75420ca | ||
|
|
51a3946519 | ||
|
|
a3beceade2 | ||
|
|
d345b9503a | ||
|
|
f8d6eb0d40 | ||
|
|
7d9b9f96f0 | ||
|
|
3017e2b3a0 | ||
|
|
09c271b7c5 | ||
|
|
adbb41799c | ||
|
|
cd6a3afc77 | ||
|
|
b932ce6246 | ||
|
|
d81fcd5f66 | ||
|
|
b7c4f1f086 | ||
|
|
a52adcad4a | ||
|
|
3ec2d6014b | ||
|
|
585dde6cf5 | ||
|
|
c9c375f3b8 | ||
|
|
2e63393bf2 | ||
|
|
1fcc2c4918 | ||
|
|
7e1d282b1b | ||
|
|
e41b98b5d4 | ||
|
|
b215940277 | ||
|
|
e19167dffa | ||
|
|
d35dbdea92 | ||
|
|
76eac7ce6a | ||
|
|
ccbeb162cf | ||
|
|
f1c23f25f0 | ||
|
|
715280b03a | ||
|
|
f166c96ed5 | ||
|
|
b461d24f52 | ||
|
|
249bfa3412 | ||
|
|
fd5f992be4 | ||
|
|
4c1b485d47 | ||
|
|
12a41d7dd2 | ||
|
|
3d18c71201 | ||
|
|
1a71e9b4a0 | ||
|
|
ca6ce2ba8b | ||
|
|
724392a557 | ||
|
|
4283b1ee30 | ||
|
|
f899408fc9 | ||
|
|
65b9b70ff8 | ||
|
|
a8d7764146 | ||
|
|
99c7867522 | ||
|
|
480587c826 | ||
|
|
1f83bef1b5 | ||
|
|
1745d06bb7 | ||
|
|
12d7b92556 | ||
|
|
6fb0fc7b71 | ||
|
|
f694939fc7 | ||
|
|
c4546b6da6 | ||
|
|
03eadcebf1 | ||
|
|
71641c5743 | ||
|
|
ebc18cd2d4 | ||
|
|
d0d9de37f4 | ||
|
|
1bfdc7438a | ||
|
|
9352ecca1f | ||
|
|
5cd5986211 | ||
|
|
39419bb411 | ||
|
|
774c624687 | ||
|
|
5439390461 | ||
|
|
6fc4dacd42 | ||
|
|
83a5b8e078 | ||
|
|
9c482b9f2a | ||
|
|
d037515e37 | ||
|
|
cc37a7d848 | ||
|
|
24eebfeb61 | ||
|
|
36a72de080 | ||
|
|
6787d717f9 | ||
|
|
37a261587e | ||
|
|
1f451bf240 | ||
|
|
fb252706f9 | ||
|
|
0e175ba373 | ||
|
|
d55cc58b8b | ||
|
|
d70c14a411 | ||
|
|
7c29e286f8 | ||
|
|
510b1aedcf | ||
|
|
200f4010d8 | ||
|
|
bd891ea56a | ||
|
|
ef83a0c15e | ||
|
|
8edce66c08 | ||
|
|
eea6461369 | ||
|
|
f21ec76bc0 | ||
|
|
86cbf7e35f | ||
|
|
2a9c6d9387 | ||
|
|
59517a1fa0 | ||
|
|
d4fd222251 | ||
|
|
1a98886aa3 | ||
|
|
c9738aa7ea | ||
|
|
dec602a27b | ||
|
|
419c15ee8e | ||
|
|
b092b6861a | ||
|
|
ef5fd503cd | ||
|
|
b2e9d4cc21 | ||
|
|
d7b142beb7 | ||
|
|
61a4382bd8 | ||
|
|
d410a320d7 | ||
|
|
dbcb60433b | ||
|
|
4b42a5fd86 | ||
|
|
e830ea6714 | ||
|
|
8a37eeea74 | ||
|
|
938d33941d | ||
|
|
9785e9b298 | ||
|
|
db8c4a5ac4 | ||
|
|
0c9f268f99 | ||
|
|
1096177cce | ||
|
|
ee039c69a8 | ||
|
|
4adfe6de70 | ||
|
|
7ae405a254 | ||
|
|
6e7fddee7d | ||
|
|
166f2d262d | ||
|
|
d658a833c9 | ||
|
|
fd72977505 | ||
|
|
50d65e3a9f | ||
|
|
18981ab0c9 | ||
|
|
c69a1205c0 | ||
|
|
56e749df9f | ||
|
|
a2287fd183 | ||
|
|
587f5a76e6 | ||
|
|
cd099bf3b1 | ||
|
|
9bbfeed1bc | ||
|
|
e23a44bcdf | ||
|
|
3a8608db19 | ||
|
|
d2173c1fa4 | ||
|
|
7fe66581f1 | ||
|
|
72ff353e9f | ||
|
|
2e759d5156 | ||
|
|
086fa4385f | ||
|
|
6f4ce8dc2f | ||
|
|
396ea54894 | ||
|
|
8a373b25ba | ||
|
|
30d58f77db | ||
|
|
17da4f64a7 | ||
|
|
4d72165288 | ||
|
|
a7ccb175e5 | ||
|
|
5ae1b5457b | ||
|
|
fc735eaa4f | ||
|
|
eb4236011b | ||
|
|
50dbe39cda | ||
|
|
cd90dcb1e1 | ||
|
|
d4de81ed6d | ||
|
|
e357aed3e1 | ||
|
|
abf87a6946 | ||
|
|
a6b7c812f2 | ||
|
|
996b5e9f87 | ||
|
|
12df7b6ab9 | ||
|
|
59fa5c2fe6 | ||
|
|
2057613ad9 | ||
|
|
2d83efc7e3 | ||
|
|
da0af36086 | ||
|
|
411d276ed2 | ||
|
|
a8da077613 | ||
|
|
74f0ae5bbb | ||
|
|
d892a89f45 | ||
|
|
919633b2be | ||
|
|
a6ec22d7fe | ||
|
|
fe4f71296f | ||
|
|
5d099d24ee | ||
|
|
44302f1aea | ||
|
|
6b2d8a3c34 | ||
|
|
ef7a334414 | ||
|
|
5b5380659e | ||
|
|
00d485b2c5 | ||
|
|
4d7b059eb3 | ||
|
|
2164d93f36 | ||
|
|
7b0c6ea940 | ||
|
|
93b5801592 | ||
|
|
911d5832c6 | ||
|
|
b44143d24d | ||
|
|
b970596310 | ||
|
|
b642a8fe51 | ||
|
|
cd5b074a48 | ||
|
|
2448b9ee55 | ||
|
|
2dc721c538 | ||
|
|
90a90e1a3c | ||
|
|
61031f1633 | ||
|
|
e7e51d9e4f | ||
|
|
43e70830ed | ||
|
|
9e545e9628 | ||
|
|
f03bdb91a4 | ||
|
|
9e944e4525 | ||
|
|
9827887643 | ||
|
|
60a9268ff5 | ||
|
|
214350a8f5 | ||
|
|
53abc326b6 | ||
|
|
9e7230e63a | ||
|
|
15d0e6abc5 | ||
|
|
cd349ab6cc | ||
|
|
38ccf7ffdd | ||
|
|
6aeae12775 | ||
|
|
e9d5b44009 | ||
|
|
f15c6da887 | ||
|
|
e9c7b02049 | ||
|
|
a39dccad19 | ||
|
|
277fa7dbe1 | ||
|
|
fbbcec2ba3 | ||
|
|
86d8fe1285 | ||
|
|
1a57d1864a | ||
|
|
427f656bac | ||
|
|
6977daf76a | ||
|
|
66d30344f9 | ||
|
|
bf34543085 | ||
|
|
9b10c9f6d1 | ||
|
|
9eb3975803 | ||
|
|
b192b6cd50 | ||
|
|
6e0589ce2c | ||
|
|
ee25a412dd | ||
|
|
3ff456d8ef | ||
|
|
e1f459d67a | ||
|
|
9cd807af1a | ||
|
|
f579fc6b2d | ||
|
|
1be389fd3e | ||
|
|
10838983b5 | ||
|
|
024cecec29 | ||
|
|
0f8a8869cb | ||
|
|
cff284b2f3 | ||
|
|
9ecc56ad4d | ||
|
|
e559834379 | ||
|
|
08915d88d0 | ||
|
|
b32c552fbc | ||
|
|
daf1dbb3a1 | ||
|
|
32678015c9 | ||
|
|
089aa1df33 | ||
|
|
0a9ffa58c1 | ||
|
|
d3eff46305 | ||
|
|
45eba9f62e | ||
|
|
efd2e85f12 | ||
|
|
c175dfe68b | ||
|
|
89e6d86bf7 | ||
|
|
e903bf2b5c | ||
|
|
294517a8e0 | ||
|
|
25e8caa64e | ||
|
|
bf32acaadd | ||
|
|
290caba160 | ||
|
|
b356c34dc4 | ||
|
|
a4f2325902 | ||
|
|
a4d9f7dbbe | ||
|
|
d463511cff | ||
|
|
c01988ba43 | ||
|
|
e74927a54c | ||
|
|
ab0783edcc | ||
|
|
882423f935 | ||
|
|
d5978a5092 | ||
|
|
df6983b3c5 | ||
|
|
d56b5f30c8 | ||
|
|
b447501d72 | ||
|
|
480d099d81 | ||
|
|
d7060b0c4b | ||
|
|
09ebb1dcdc | ||
|
|
f31eaef0d9 | ||
|
|
68a6a08a01 | ||
|
|
797b68fc20 | ||
|
|
cfb317abdd | ||
|
|
18f3e11c10 | ||
|
|
90e8f062e9 | ||
|
|
c79137d14c | ||
|
|
4f76626f51 | ||
|
|
2c07d2df22 | ||
|
|
c88e63ecc9 | ||
|
|
e2ce31e1a7 | ||
|
|
1e78c4c418 | ||
|
|
4bce208035 | ||
|
|
7b6488b1c7 | ||
|
|
025036595d | ||
|
|
8a4e957554 | ||
|
|
dae3e03603 | ||
|
|
1239e8600a | ||
|
|
4839d06fc3 | ||
|
|
eac6ac0247 | ||
|
|
09dde659d5 | ||
|
|
d65cb29536 | ||
|
|
fd55ded996 | ||
|
|
755d353dfa | ||
|
|
84fec7c5c7 | ||
|
|
2be6011069 | ||
|
|
fcf99c9bc2 | ||
|
|
eb09519a26 | ||
|
|
9ebe383beb | ||
|
|
a47f3cb0e5 | ||
|
|
2cedcfece2 | ||
|
|
ddbd6c371d | ||
|
|
03c1521cde | ||
|
|
f49552f6b7 | ||
|
|
39f35bbaab | ||
|
|
d21bb1e6b1 | ||
|
|
fdbe4051f1 | ||
|
|
9c60474953 | ||
|
|
3dd160c663 | ||
|
|
9f17e56923 | ||
|
|
25958c241b | ||
|
|
ed6e3fe8a0 | ||
|
|
f9ed1592e1 | ||
|
|
c3997194b2 | ||
|
|
fd4a19855d | ||
|
|
1fd9f5e1fb | ||
|
|
55c0a99bce | ||
|
|
487b5b25db | ||
|
|
31818e8816 | ||
|
|
3a2f44adac | ||
|
|
380b61a0e9 | ||
|
|
edb79de54e | ||
|
|
f185a09693 | ||
|
|
8d5c853267 | ||
|
|
e82aa97d0e | ||
|
|
5e71ff816f | ||
|
|
351c416ed8 | ||
|
|
f408c886b6 | ||
|
|
3d8c5b377b | ||
|
|
7a8a95c815 | ||
|
|
94f14f529b | ||
|
|
bcba4a1a38 | ||
|
|
ac58fd91af | ||
|
|
eb2ea07c76 | ||
|
|
5898d27609 | ||
|
|
1559c45a61 | ||
|
|
70e6c2d41f | ||
|
|
5c76229cdf | ||
|
|
3bb1756a13 | ||
|
|
8b275c6e5c | ||
|
|
bd002656cd | ||
|
|
f68d956eaa | ||
|
|
e020a859f0 |
@@ -2,6 +2,7 @@
|
||||
# from Dolibarr GitHub repository.
|
||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||
|
||||
dist: precise
|
||||
sudo: required
|
||||
|
||||
language: php
|
||||
@@ -10,7 +11,7 @@ php:
|
||||
- '5.3'
|
||||
- '5.4'
|
||||
- '5.5'
|
||||
- '5.6'
|
||||
- '5.6.29'
|
||||
- '7.0'
|
||||
- nightly
|
||||
|
||||
@@ -130,10 +131,10 @@ before_script:
|
||||
echo "Set timezone"
|
||||
echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||
if [ "$TRAVIS_PHP_VERSION" = '5.3' ] || [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then
|
||||
echo
|
||||
echo "Enabling APC for PHP <= 5.4"
|
||||
#echo
|
||||
#echo "Enabling APC for PHP <= 5.4"
|
||||
# Documentation says it should be available for PHP <= 5.6 but it's not for 5.5 and 5.6!
|
||||
echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||
#echo 'extension = apc.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini
|
||||
echo
|
||||
echo "Enabling Memcached for PHP <= 5.4"
|
||||
# Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0 and nightly!
|
||||
|
||||
77
ChangeLog
77
ChangeLog
@@ -12,6 +12,83 @@ Upgrading to any other version or any other database system is abolutely require
|
||||
make a Dolibarr upgrade.
|
||||
|
||||
|
||||
***** ChangeLog for 4.0.6 to 4.0.5 *****
|
||||
FIX: #6613 Default subject for Supplier proposal emails is filled with a non-existing key
|
||||
FIX: #6623 User card shows "Return to list" link even if the user has no rights to list users
|
||||
FIX: #6636 Complete fix
|
||||
FIX: #6669 User with no permission to edit customer invoices can see a edit button in project entry
|
||||
FIX: #6671 Cannot remove thirdparty type with "#" in its name
|
||||
FIX: #6673 Missing "nature" table header in thirdparty list
|
||||
FIX: #6675 Restricted user with no agenda permissions can see a button to create appointment in thirdparty contact list
|
||||
FIX: #6677 Expired contracts dashboard box does not show the name of the thirdparty
|
||||
FIX: #6679 User with restricted supplier invoice permissions can edit project, payment conditions, payment mode
|
||||
FIX: #6680 User with restricted supplier invoice permissions sees "reopen" button even if he has no permission to do it
|
||||
FIX: #6813
|
||||
FIX: Correction with author and validator user on orders
|
||||
FIX: doactions hook missing in invoice model page
|
||||
FIX: dont get empty "Incoterms : - " string if no incoterm
|
||||
FIX: dont lose supplier ref if no supplier price in database
|
||||
FIX: forgotten parameter for right multicompany use
|
||||
FIX: global $dateSelector isn't the good one, then date selector on objectline_create tpl was hidden
|
||||
FIX: limit+1 dosn't show Total line
|
||||
FIX: supplier order line were always created with rang = 0
|
||||
|
||||
|
||||
***** ChangeLog for 4.0.5 to 4.0.4 *****
|
||||
FIX: #6234
|
||||
FIX: #6259
|
||||
FIX: #6330
|
||||
FIX: #6360
|
||||
FIX: #6411
|
||||
FIX: #6443
|
||||
FIX: #6444
|
||||
FIX: #6453
|
||||
FIX: #6503: SQL error in "Last pending payment invoices"
|
||||
FIX: #6505 Project elements page shows greyed-out links even if the option to show actions not available is disabled
|
||||
FIX: #6507: Statistics counter show wrong total Contract numbers when the user does not have full access
|
||||
FIX: #6533 #6590
|
||||
FIX: #6619 Template invoices list do not respect restricted thirdparty user rights
|
||||
FIX: #6621 Documents tab shows greyed out upload form even if the option to show actions not available is disabled
|
||||
FIX: add entity param to document link
|
||||
FIX: Can use quote into supplier ref on order line add
|
||||
FIX: Change the customer code only if error on duplicate
|
||||
FIX: Creation of credit note on invoice with deposit stole the discount.
|
||||
FIX: delete bank class lines when we delete bank_categ
|
||||
FIX: deletion of bank tag
|
||||
FIX: detail of deposit and credit not was not visible into final invoice
|
||||
FIX: Error management during bank account creation
|
||||
FIX: error management in bank account deletion.
|
||||
FIX: event status is not modified when assign an user
|
||||
FIX: forgotten fk_facture_fourn attribute on supplierinvoice line object
|
||||
FIX: If bank module on, field must be required to register payment of expense report.
|
||||
FIX: load multicurrency informations on supplier order and bill lines fetch
|
||||
FIX: Missing total on project overview.
|
||||
FIX: multicurrency_subprice
|
||||
FIX: param billed when we change page
|
||||
FIX: protection against infinite loop on hierarchy
|
||||
FIX: Supplier Order list filter by project
|
||||
FIX: the dolCopyDir fails if target dir does not exists.
|
||||
FIX: use param for http links
|
||||
|
||||
***** ChangeLog for 4.0.4 to 4.0.3 *****
|
||||
FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish
|
||||
FIX: #6230
|
||||
FIX: #6237
|
||||
FIX: #6245 Thirdparty link in supplier invoices list, links to "comm/card" instead of "fourn/card" page
|
||||
FIX: #6253 Supplier invoice list filter does not respect "thirdparty" filter
|
||||
FIX: #6277
|
||||
FIX: project list and ajax completion return wrong list.
|
||||
FIX: bug margin calculation by user with multicompany
|
||||
FIX: Can make a stock transfert on product not on sale/purchase.
|
||||
FIX: extrafield input for varchar was not working with special char within (ie double quotes)
|
||||
FIX: javascript error
|
||||
FIX: link for not found photo when using gravatar. Must use external url.
|
||||
FIX: Protection so even if link is output for external user, links is disabled.
|
||||
FIX: repair tool was ko to restore extrafields with type select.
|
||||
FIX: Security access problem with external users on projects/tasks
|
||||
FIX: We must not drop extrafield column if there is still record on other entities.
|
||||
FIX: regression with sedning email when introducing security options to restrict nb of email sending.
|
||||
t
|
||||
***** ChangeLog for 4.0.3 to 4.0.2 *****
|
||||
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
|
||||
FIX: #5958 no discount on supplier command made by replenishment
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# DOLIBARR ERP & CRM
|
||||
|
||||
 
|
||||
 
|
||||
|
||||
Dolibarr ERP & CRM is a modern software package to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
|
||||
|
||||
|
||||
@@ -353,10 +353,12 @@ begin
|
||||
begin
|
||||
// TODO Copy file or ask to install package ?
|
||||
//CustomMessage('YouWillInstallDoliWamp')+#13#13
|
||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
|
||||
end;
|
||||
|
||||
|
||||
// Pb seems similar with msvcp110.dll
|
||||
//vcredist_x64.exe
|
||||
|
||||
|
||||
// If we have a new database version, we should only copy old my.ini file into new directory
|
||||
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
|
||||
// Install of service and stop/start scripts are already rebuild by installer.
|
||||
|
||||
@@ -19,7 +19,7 @@ use Cwd;
|
||||
# Change this to defined target for option 98 and 99
|
||||
$PROJECT="dolibarr";
|
||||
$PUBLISHSTABLE="eldy,dolibarr\@frs.sourceforge.net:/home/frs/project/dolibarr";
|
||||
$PUBLISHBETARC="ldestailleur\@asso.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
|
||||
$PUBLISHBETARC="dolibarr\@vmprod1.dolibarr.org:/home/dolibarr/dolibarr.org/httpdocs/files";
|
||||
|
||||
|
||||
#@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
||||
@@ -518,6 +518,7 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/dolimed*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/dolimod*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/forceproject*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/lead*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
|
||||
|
||||
@@ -162,7 +162,7 @@ export res=$?
|
||||
|
||||
|
||||
# ---------------------------- copy demo files
|
||||
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" `
|
||||
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
|
||||
if [ "x$documentdir" != "x" ]
|
||||
then
|
||||
echo cp -pr $mydir/documents_demo/* "$documentdir/"
|
||||
@@ -174,7 +174,7 @@ then
|
||||
echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
||||
cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
||||
else
|
||||
echo Detection of documents directory failed so demo files were not copied.
|
||||
echo Detection of documents directory from $mydir failed so demo files were not copied.
|
||||
fi
|
||||
|
||||
|
||||
|
||||
1
htdocs/.gitignore
vendored
1
htdocs/.gitignore
vendored
@@ -4,6 +4,7 @@
|
||||
/dolimed*
|
||||
/ecommerce*
|
||||
/extensions*
|
||||
/forceproject*
|
||||
/google*
|
||||
/lead
|
||||
/multicompany*
|
||||
|
||||
@@ -433,18 +433,18 @@ class Adherent extends CommonObject
|
||||
$sql.= ", town=" .($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||
$sql.= ", country=".($this->country_id>0?"'".$this->country_id."'":"null");
|
||||
$sql.= ", state_id=".($this->state_id>0?"'".$this->state_id."'":"null");
|
||||
$sql.= ", email='".$this->email."'";
|
||||
$sql.= ", skype='".$this->skype."'";
|
||||
$sql.= ", email='".$this->db->escape($this->email)."'";
|
||||
$sql.= ", skype='".$this->db->escape($this->skype)."'";
|
||||
$sql.= ", phone=" .($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||
$sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||
$sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
$sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null");
|
||||
$sql.= ", note_public=" .($this->note_private?"'".$this->db->escape($this->note_public)."'":"null");
|
||||
$sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null");
|
||||
$sql.= ", public='".$this->public."'";
|
||||
$sql.= ", public='".$this->db->escape($this->public)."'";
|
||||
$sql.= ", statut=" .$this->statut;
|
||||
$sql.= ", fk_adherent_type=".$this->typeid;
|
||||
$sql.= ", morphy='".$this->morphy."'";
|
||||
$sql.= ", morphy='".$this->db->escape($this->morphy)."'";
|
||||
$sql.= ", birth=" .($this->birth?"'".$this->db->idate($this->birth)."'":"null");
|
||||
if ($this->datefin) $sql.= ", datefin='".$this->db->idate($this->datefin)."'"; // Ne doit etre modifie que par effacement cotisation
|
||||
if ($this->datevalid) $sql.= ", datevalid='".$this->db->idate($this->datevalid)."'"; // Ne doit etre modifie que par validation adherent
|
||||
@@ -643,7 +643,7 @@ class Adherent extends CommonObject
|
||||
// Search for last subscription id and end date
|
||||
$sql = "SELECT rowid, datec as dateop, dateadh as datedeb, datef as datefin";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."cotisation";
|
||||
$sql.= " WHERE fk_adherent='".$this->id."'";
|
||||
$sql.= " WHERE fk_adherent=".$this->id;
|
||||
$sql.= " ORDER by dateadh DESC"; // Sort by start subscription date
|
||||
|
||||
dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG);
|
||||
|
||||
@@ -909,7 +909,7 @@ print "<br>\n";
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
|
||||
@@ -46,14 +46,17 @@ $action=GETPOST('action');
|
||||
*/
|
||||
|
||||
// positionne la variable pour le nombre de rss externes
|
||||
$sql ="SELECT MAX(".$db->decrypt('name').") as name FROM ".MAIN_DB_PREFIX."const";
|
||||
$sql ="SELECT ".$db->decrypt('name')." as name FROM ".MAIN_DB_PREFIX."const";
|
||||
$sql.=" WHERE ".$db->decrypt('name')." LIKE 'EXTERNAL_RSS_URLRSS_%'";
|
||||
$result=$db->query($sql);
|
||||
//print $sql;
|
||||
$result=$db->query($sql); // We can't use SELECT MAX() because EXTERNAL_RSS_URLRSS_10 is lower than EXTERNAL_RSS_URLRSS_9
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
preg_match('/([0-9]+)$/i',$obj->name,$reg);
|
||||
if ($reg[1]) $lastexternalrss = $reg[1];
|
||||
while ($obj = $db->fetch_object($result))
|
||||
{
|
||||
preg_match('/([0-9]+)$/i',$obj->name,$reg);
|
||||
if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -193,7 +193,7 @@ foreach ($modulesdir as $dir)
|
||||
}
|
||||
ksort($arrayofnatures);
|
||||
}
|
||||
|
||||
|
||||
// Define array $categ with categ with at least one qualified module
|
||||
if ($modulequalified > 0)
|
||||
{
|
||||
@@ -315,13 +315,13 @@ if ($mode != 'marketplace')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
|
||||
$moreforfilter = '';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
|
||||
$moreforfilter.= '</div>';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, $search_nature, 1);
|
||||
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1);
|
||||
$moreforfilter.= '</div>';
|
||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
{
|
||||
@@ -342,7 +342,7 @@ if ($mode != 'marketplace')
|
||||
$moreforfilter.=' ';
|
||||
$moreforfilter.='<input type="submit" name="buttonreset" class="button" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
|
||||
$moreforfilter.= '</div>';
|
||||
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
//print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
@@ -351,11 +351,11 @@ if ($mode != 'marketplace')
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
//print '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print '<br><br><br>';
|
||||
|
||||
|
||||
|
||||
|
||||
// Show list of modules
|
||||
|
||||
print '<table summary="list_of_modules" id="list_of_modules" class="liste" width="100%">'."\n";
|
||||
@@ -370,7 +370,7 @@ if ($mode != 'marketplace')
|
||||
$modName = $filename[$key];
|
||||
$objMod = $modules[$key];
|
||||
$dirofmodule = $dirmod[$key];
|
||||
|
||||
|
||||
$special = $objMod->special;
|
||||
|
||||
//print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."<br>";
|
||||
@@ -383,9 +383,9 @@ if ($mode != 'marketplace')
|
||||
dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
|
||||
|
||||
|
||||
// Check filters
|
||||
$modulename=$objMod->getName();
|
||||
$moduledesc=$objMod->getDesc();
|
||||
@@ -396,7 +396,7 @@ if ($mode != 'marketplace')
|
||||
if ($search_keyword)
|
||||
{
|
||||
$qualified=0;
|
||||
if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
|
||||
if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
|
||||
|| preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
|
||||
@@ -415,7 +415,7 @@ if ($mode != 'marketplace')
|
||||
{
|
||||
//print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
|
||||
$publisher=dol_escape_htmltag($objMod->getPublisher());
|
||||
if ($reg[1] && $reg[1] != $publisher) continue;
|
||||
if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) continue;
|
||||
if (! $reg[1] && ! empty($publisher)) continue;
|
||||
}
|
||||
if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue;
|
||||
@@ -496,7 +496,7 @@ if ($mode != 'marketplace')
|
||||
$text='';
|
||||
if ($objMod->getDescLong()) $text.=$objMod->getDesc().'<br>'.$objMod->getDescLong().'<br>';
|
||||
else $text.=$objMod->getDesc().'<br>';
|
||||
|
||||
|
||||
$textexternal='';
|
||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
@@ -522,7 +522,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
|
||||
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
|
||||
{
|
||||
@@ -534,7 +534,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
|
||||
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
|
||||
{
|
||||
@@ -553,14 +553,14 @@ if ($mode != 'marketplace')
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
|
||||
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
|
||||
{
|
||||
@@ -572,14 +572,14 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
|
||||
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
|
||||
{
|
||||
@@ -603,14 +603,14 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
|
||||
if (isset($objMod->menu) && is_array($objMod->menu) && ! empty($objMod->menu))
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
|
||||
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
|
||||
{
|
||||
@@ -622,7 +622,7 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
|
||||
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
|
||||
{
|
||||
@@ -634,25 +634,25 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
|
||||
$text.=$langs->trans("DetectionNotPossible");
|
||||
|
||||
|
||||
print $form->textwithpicto('', $text, 1, 'help', 'minheight20');
|
||||
|
||||
// Picto warning
|
||||
// Picto warning
|
||||
$version=$objMod->getVersion(0);
|
||||
$versiontrans=$objMod->getVersion(1);
|
||||
if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"');
|
||||
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"');
|
||||
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"');
|
||||
|
||||
|
||||
// Picto external
|
||||
if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"');
|
||||
|
||||
|
||||
|
||||
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Version
|
||||
print '<td align="center" valign="top" class="nowrap">';
|
||||
print $versiontrans;
|
||||
|
||||
@@ -274,7 +274,7 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 21) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
if (substr($file, 0, 22) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
|
||||
|
||||
@@ -69,12 +69,18 @@ if ($action=='install')
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! preg_match('/\.zip/i',$original_file))
|
||||
if (! preg_match('/\.zip$/i',$original_file))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i',$original_file))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@@ -117,7 +123,7 @@ if ($action=='install')
|
||||
//var_dump($modulenamedir);
|
||||
if (! dol_is_dir($modulenamedir))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'<br>Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'<br>'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1489,14 +1489,14 @@ class Categorie extends CommonObject
|
||||
{
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
|
||||
if (dol_is_file($dir.$file) && preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
|
||||
{
|
||||
$nbphoto++;
|
||||
$photo = $file;
|
||||
|
||||
// On determine nom du fichier vignette
|
||||
$photo_vignette='';
|
||||
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs))
|
||||
if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs))
|
||||
{
|
||||
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo).'_small'.$regs[0];
|
||||
}
|
||||
@@ -1539,7 +1539,7 @@ class Categorie extends CommonObject
|
||||
dol_delete_file($file,1);
|
||||
|
||||
// Si elle existe, on efface la vignette
|
||||
if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs))
|
||||
if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs))
|
||||
{
|
||||
$photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_small'.$regs[0];
|
||||
if (file_exists($dirthumb.$photo_vignette))
|
||||
|
||||
@@ -853,6 +853,9 @@ if ($id > 0)
|
||||
$result3=$object->fetch_contact();
|
||||
$result4=$object->fetch_userassigned();
|
||||
$result5=$object->fetch_optionals($id,$extralabels);
|
||||
|
||||
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
|
||||
|
||||
|
||||
if($listUserAssignedUpdated || $donotclearsession) {
|
||||
|
||||
@@ -1030,7 +1033,7 @@ if ($id > 0)
|
||||
|
||||
// Status
|
||||
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
|
||||
$percent=GETPOST("percentage")?GETPOST("percentage"):$object->percentage;
|
||||
$percent = GETPOST("percentage") ? GETPOST("percentage"): $object->percentage;
|
||||
$formactions->form_select_status_action('formaction',$percent,1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.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
|
||||
@@ -1255,6 +1255,7 @@ class ActionComm extends CommonObject
|
||||
{
|
||||
// Note: Output of sql request is encoded in $conf->file->character_set_client
|
||||
// This assignment in condition is not a bug. It allows walking the results.
|
||||
$diff = 0;
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$qualified=true;
|
||||
@@ -1289,8 +1290,9 @@ class ActionComm extends CommonObject
|
||||
|
||||
if ($qualified && $datestart)
|
||||
{
|
||||
$eventarray[$datestart]=$event;
|
||||
$eventarray[$datestart+$diff]=$event;
|
||||
}
|
||||
$diff++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -933,7 +933,14 @@ if (count($listofextcals))
|
||||
// Complete $eventarray with events coming from external module
|
||||
$parameters=array(); $object=null;
|
||||
$reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action);
|
||||
if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']);
|
||||
if (! empty($hookmanager->resArray['eventarray'])) {
|
||||
foreach ($hookmanager->resArray['eventarray'] as $keyDate => $events) {
|
||||
if (!isset($eventarray[$keyDate])) {
|
||||
$eventarray[$keyDate]=array();
|
||||
}
|
||||
$eventarray[$keyDate]=array_merge($eventarray[$keyDate], $events);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -755,7 +755,7 @@ else
|
||||
|
||||
// MAILING_NO_USING_PHPMAIL may be defined or not.
|
||||
// MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden).
|
||||
// MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0=no limit).
|
||||
// MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit).
|
||||
if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
|
||||
{
|
||||
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
|
||||
@@ -769,8 +769,8 @@ else
|
||||
}
|
||||
else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1')
|
||||
{
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings');
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings');
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
|
||||
|
||||
// The feature is forbidden from GUI, we show just message to use from command line.
|
||||
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
|
||||
@@ -783,8 +783,8 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings');
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings');
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
|
||||
if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
|
||||
|
||||
$text='';
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0)
|
||||
|
||||
@@ -911,7 +911,7 @@ class Propal extends CommonObject
|
||||
if ($this->id)
|
||||
{
|
||||
$this->ref='(PROV'.$this->id.')';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->ref."' WHERE rowid=".$this->id;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@@ -1136,14 +1136,9 @@ class Propal extends CommonObject
|
||||
}
|
||||
|
||||
$clonedObj->id=0;
|
||||
$clonedObj->ref='';
|
||||
$clonedObj->statut=self::STATUS_DRAFT;
|
||||
|
||||
if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
|
||||
{
|
||||
$this->error='ErrorSetupNotComplete';
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Clear fields
|
||||
$clonedObj->user_author = $user->id;
|
||||
$clonedObj->user_valid = '';
|
||||
@@ -1152,12 +1147,6 @@ class Propal extends CommonObject
|
||||
$clonedObj->fin_validite = $clonedObj->date + ($clonedObj->duree_validite * 24 * 3600);
|
||||
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = '';
|
||||
|
||||
// Set ref
|
||||
require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.'.php';
|
||||
$obj = $conf->global->PROPALE_ADDON;
|
||||
$modPropale = new $obj;
|
||||
$clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj);
|
||||
|
||||
// Create clone
|
||||
|
||||
$result=$clonedObj->create($user);
|
||||
@@ -3454,14 +3443,14 @@ class PropaleLigne extends CommonObjectLine
|
||||
$sql.= " , tva_tx='".price2num($this->tva_tx)."'";
|
||||
$sql.= " , localtax1_tx=".price2num($this->localtax1_tx);
|
||||
$sql.= " , localtax2_tx=".price2num($this->localtax2_tx);
|
||||
$sql.= " , localtax1_type='".$this->localtax1_type."'";
|
||||
$sql.= " , localtax2_type='".$this->localtax2_type."'";
|
||||
$sql.= " , localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
||||
$sql.= " , localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||
$sql.= " , qty='".price2num($this->qty)."'";
|
||||
$sql.= " , subprice=".price2num($this->subprice)."";
|
||||
$sql.= " , remise_percent=".price2num($this->remise_percent)."";
|
||||
$sql.= " , price=".price2num($this->price).""; // TODO A virer
|
||||
$sql.= " , remise=".price2num($this->remise).""; // TODO A virer
|
||||
$sql.= " , info_bits='".$this->info_bits."'";
|
||||
$sql.= " , info_bits='".$this->db->escape($this->info_bits)."'";
|
||||
if (empty($this->skip_update_total))
|
||||
{
|
||||
$sql.= " , total_ht=".price2num($this->total_ht)."";
|
||||
|
||||
@@ -114,7 +114,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
||||
$newdiscount2->amount_ttc=price2num($discount->amount_ttc-$newdiscount1->amount_ttc);
|
||||
$newdiscount1->amount_ht=price2num($newdiscount1->amount_ttc/(1+$newdiscount1->tva_tx/100),'MT');
|
||||
$newdiscount2->amount_ht=price2num($newdiscount2->amount_ttc/(1+$newdiscount2->tva_tx/100),'MT');
|
||||
$newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount2->amount_ht);
|
||||
$newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount1->amount_ht);
|
||||
$newdiscount2->amount_tva=price2num($newdiscount2->amount_ttc-$newdiscount2->amount_ht);
|
||||
|
||||
$db->begin();
|
||||
|
||||
@@ -193,7 +193,7 @@ class CommandeApi extends DolibarrApi
|
||||
* @return array Array of order objects
|
||||
*/
|
||||
function getListForSoc($socid = 0) {
|
||||
return getList(0,"s.rowid","ASC",0,0,$socid);
|
||||
return $this->getList(0,"s.rowid","ASC",0,0,$socid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@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
|
||||
@@ -135,6 +135,7 @@ class Commande extends CommonOrder
|
||||
var $linked_objects=array();
|
||||
|
||||
var $user_author_id;
|
||||
var $user_valid;
|
||||
|
||||
/**
|
||||
* @var OrderLine[]
|
||||
@@ -239,7 +240,8 @@ class Commande extends CommonOrder
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||
$this->error=$obj->error;
|
||||
//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1504,7 +1506,7 @@ class Commande extends CommonOrder
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
|
||||
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut';
|
||||
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
|
||||
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
$sql.= ', c.fk_account';
|
||||
$sql.= ', c.date_commande';
|
||||
@@ -1548,6 +1550,7 @@ class Commande extends CommonOrder
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->statut = $obj->fk_statut;
|
||||
$this->user_author_id = $obj->fk_user_author;
|
||||
$this->user_valid = $obj->fk_user_valid;
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
$this->total_localtax1 = $obj->total_localtax1;
|
||||
@@ -2765,8 +2768,8 @@ class Commande extends CommonOrder
|
||||
$sql.= " total_ht=".(isset($this->total_ht)?$this->total_ht:"null").",";
|
||||
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
|
||||
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
|
||||
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").",";
|
||||
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
|
||||
$sql.= " fk_user_author=".(isset($this->user_author_id)?$this->user_author_id:"null").",";
|
||||
$sql.= " fk_user_valid=".(isset($this->user_valid)?$this->user_valid:"null").",";
|
||||
$sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").",";
|
||||
$sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").",";
|
||||
$sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").",";
|
||||
@@ -3630,7 +3633,7 @@ class OrderLine extends CommonOrderLine
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';";
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid=".$this->rowid;
|
||||
|
||||
dol_syslog("OrderLine::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
@@ -3871,8 +3874,8 @@ class OrderLine extends CommonOrderLine
|
||||
$sql.= " , tva_tx=".price2num($this->tva_tx);
|
||||
$sql.= " , localtax1_tx=".price2num($this->localtax1_tx);
|
||||
$sql.= " , localtax2_tx=".price2num($this->localtax2_tx);
|
||||
$sql.= " , localtax1_type='".$this->localtax1_type."'";
|
||||
$sql.= " , localtax2_type='".$this->localtax2_type."'";
|
||||
$sql.= " , localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
||||
$sql.= " , localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||
$sql.= " , qty=".price2num($this->qty);
|
||||
$sql.= " , subprice=".price2num($this->subprice)."";
|
||||
$sql.= " , remise_percent=".price2num($this->remise_percent)."";
|
||||
|
||||
@@ -401,6 +401,8 @@ if ($resql)
|
||||
if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat;
|
||||
if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($billed != '') $param.='&billed='.$billed;
|
||||
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
|
||||
@@ -60,10 +60,12 @@ $extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($account->table_element);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
if ($_POST["action"] == 'add')
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
$error=0;
|
||||
|
||||
@@ -129,6 +131,8 @@ if ($_POST["action"] == 'add')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$id = $account->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
@@ -137,15 +141,20 @@ if ($_POST["action"] == 'add')
|
||||
$account->setCategories($categories);
|
||||
|
||||
$_GET["id"]=$id; // Force chargement page en mode visu
|
||||
$action='';
|
||||
|
||||
$db->commit();
|
||||
}
|
||||
else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($account->error, $account->errors, 'errors');
|
||||
$action='create'; // Force chargement page en mode creation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
if ($action == 'update' && ! $_POST["cancel"])
|
||||
{
|
||||
$error=0;
|
||||
|
||||
@@ -226,15 +235,24 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
|
||||
if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
|
||||
{
|
||||
// Delete
|
||||
$account = new Account($db);
|
||||
$account->fetch($_GET["id"]);
|
||||
$account->delete();
|
||||
$result = $account->delete($user);
|
||||
|
||||
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
|
||||
exit;
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($account->error, $account->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ if ($categid) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -79,7 +80,7 @@ if ($categid) {
|
||||
llxHeader();
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("Rubriques"), '', 'title_bank.png');
|
||||
print load_fiche_titre($langs->trans("RubriquesTransactions"), '', 'title_bank.png');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
@@ -380,7 +380,7 @@ class Account extends CommonObject
|
||||
/**
|
||||
* Add an entry into table ".MAIN_DB_PREFIX."bank
|
||||
*
|
||||
* @param int $date Date operation
|
||||
* @param int $date Date operation
|
||||
* @param string $oper 1,2,3,4... (deprecated) or TYP,VIR,PRE,LIQ,VAD,CB,CHQ...
|
||||
* @param string $label Descripton
|
||||
* @param float $amount Amount
|
||||
@@ -596,12 +596,15 @@ class Account extends CommonObject
|
||||
$accline->datec = $this->db->idate($now);
|
||||
$accline->label = '('.$langs->trans("InitialBankBalance").')';
|
||||
$accline->amount = price2num($this->solde);
|
||||
$accline->fk_user_author = $user->id;
|
||||
$accline->fk_account = $this->id;
|
||||
$accline->datev = $this->db->idate($this->date_solde);
|
||||
$accline->dateo = $this->db->idate($this->date_solde);
|
||||
$accline->fk_type = 'SOLD';
|
||||
|
||||
if ($accline->insert() < 0) {
|
||||
$this->error = $accline->error;
|
||||
$this->errors = $accline->errors;
|
||||
return -3;
|
||||
}
|
||||
|
||||
@@ -680,17 +683,17 @@ class Account extends CommonObject
|
||||
$sql.= ",accountancy_journal = '".$this->accountancy_journal."'";
|
||||
|
||||
$sql.= ",bank = '".$this->db->escape($this->bank)."'";
|
||||
$sql.= ",code_banque='".$this->code_banque."'";
|
||||
$sql.= ",code_guichet='".$this->code_guichet."'";
|
||||
$sql.= ",number='".$this->number."'";
|
||||
$sql.= ",cle_rib='".$this->cle_rib."'";
|
||||
$sql.= ",bic='".$this->bic."'";
|
||||
$sql.= ",iban_prefix = '".$this->iban."'";
|
||||
$sql.= ",code_banque='".$this->db->escape($this->code_banque)."'";
|
||||
$sql.= ",code_guichet='".$this->db->escape($this->code_guichet)."'";
|
||||
$sql.= ",number='".$this->db->escape($this->number)."'";
|
||||
$sql.= ",cle_rib='".$this->db->escape($this->cle_rib)."'";
|
||||
$sql.= ",bic='".$this->db->escape($this->bic)."'";
|
||||
$sql.= ",iban_prefix = '".$this->db->escape($this->iban)."'";
|
||||
$sql.= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
|
||||
$sql.= ",proprio = '".$this->db->escape($this->proprio)."'";
|
||||
$sql.= ",owner_address = '".$this->db->escape($this->owner_address)."'";
|
||||
|
||||
$sql.= ",currency_code = '".$this->currency_code."'";
|
||||
$sql.= ",currency_code = '".$this->db->escape($this->currency_code)."'";
|
||||
|
||||
$sql.= ",min_allowed = ".($this->min_allowed != '' ? price2num($this->min_allowed) : "null");
|
||||
$sql.= ",min_desired = ".($this->min_desired != '' ? price2num($this->min_desired) : "null");
|
||||
@@ -764,12 +767,12 @@ class Account extends CommonObject
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_account SET ";
|
||||
$sql.= " bank = '".$this->db->escape($this->bank)."'";
|
||||
$sql.= ",code_banque='".$this->code_banque."'";
|
||||
$sql.= ",code_guichet='".$this->code_guichet."'";
|
||||
$sql.= ",number='".$this->number."'";
|
||||
$sql.= ",cle_rib='".$this->cle_rib."'";
|
||||
$sql.= ",bic='".$this->bic."'";
|
||||
$sql.= ",iban_prefix = '".$this->iban."'";
|
||||
$sql.= ",code_banque='".$this->db->escape($this->code_banque)."'";
|
||||
$sql.= ",code_guichet='".$this->db->escape($this->code_guichet)."'";
|
||||
$sql.= ",number='".$this->db->escape($this->number)."'";
|
||||
$sql.= ",cle_rib='".$this->db->escape($this->cle_rib)."'";
|
||||
$sql.= ",bic='".$this->db->escape($this->bic)."'";
|
||||
$sql.= ",iban_prefix = '".$this->db->escape($this->iban)."'";
|
||||
$sql.= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
|
||||
$sql.= ",proprio = '".$this->db->escape($this->proprio)."'";
|
||||
$sql.= ",owner_address = '".$this->db->escape($this->owner_address)."'";
|
||||
@@ -947,29 +950,60 @@ class Account extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
// Remove extrafields
|
||||
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Delete link between tag and bank account
|
||||
if (! $error)
|
||||
{
|
||||
//$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class"; // No more used
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_account";
|
||||
$sql.= " WHERE fk_account = ".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
// Remove extrafields
|
||||
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->deleteExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
dol_print_error($this->db);
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,29 +188,60 @@ class BankCateg // extends CommonObject
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that delete
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user User that delete
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
// Delete link between tag and bank account
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_account";
|
||||
$sql.= " WHERE fk_categorie = ".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
|
||||
// Delete link between tag and bank lines
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class";
|
||||
$sql.= " WHERE fk_categ = ".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
// Delete bank categ
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$error++;
|
||||
$this->errors[] = "Error ".$this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
|
||||
@@ -282,6 +282,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
|
||||
$refcomp=$societestatic->getNomUrl(1,'',24);
|
||||
|
||||
$paiement = $facturestatic->getSommePaiement(); // Payment already done
|
||||
$paiement+= $facturestatic->getSumDepositsUsed();
|
||||
$paiement+= $facturestatic->getSumCreditNotesUsed();
|
||||
}
|
||||
if ($obj->family == 'social_contribution')
|
||||
{
|
||||
|
||||
@@ -812,14 +812,14 @@ if (empty($reshook))
|
||||
$line->fk_parent_line = $fk_parent_line;
|
||||
|
||||
$line->subprice =-$line->subprice; // invert price for object
|
||||
$line->pa_ht = -$line->pa_ht;
|
||||
$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;
|
||||
|
||||
$result = $line->insert();
|
||||
$result = $line->insert(0, 1); // When creating credit note with same lines than source, we must ignore error if discount alreayd linked
|
||||
|
||||
$object->lines[] = $line; // insert new line in current object
|
||||
|
||||
@@ -1153,7 +1153,9 @@ if (empty($reshook))
|
||||
|
||||
// Extrafields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
||||
$lines[$i]->fetch_optionals($lines[$i]->rowid);
|
||||
$targetExtraFields = new ExtraFields($db);
|
||||
$targetExtraFieldLabels = $targetExtraFields->fetch_name_optionals_label($object->table_element_line);
|
||||
$lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraFieldLabels);
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
@@ -1998,7 +2000,7 @@ if ($action == 'create')
|
||||
if (!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts();
|
||||
$note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null));
|
||||
$note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null));
|
||||
|
||||
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
@@ -2197,7 +2199,7 @@ if ($action == 'create')
|
||||
if ((empty($origin)) || ((($origin == 'propal') || ($origin == 'commande')) && (! empty($originid))))
|
||||
{
|
||||
// Deposit
|
||||
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
|
||||
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
|
||||
@@ -2208,7 +2210,7 @@ if ($action == 'create')
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
$desc = $form->textwithpicto($tmp.$langs->trans("InvoiceDeposit"), $langs->transnoentities("InvoiceDepositDesc"), 1, 'help', '', 0, 3);
|
||||
print '<table class="nobordernopadding"><tr><td>';
|
||||
print $desc;
|
||||
@@ -2222,7 +2224,7 @@ if ($action == 'create')
|
||||
print '<td class="nowrap" style="padding-left: 5px">' . $langs->trans('Value') . ':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="' . GETPOST('valuedeposit', 'int') . '"/>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
@@ -2254,7 +2256,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Replacement
|
||||
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
|
||||
if (empty($conf->global->INVOICE_DISABLE_REPLACEMENT))
|
||||
{
|
||||
print '<!-- replacement line -->';
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
@@ -2301,7 +2303,7 @@ if ($action == 'create')
|
||||
if ($socid > 0)
|
||||
{
|
||||
// Credit note
|
||||
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
|
||||
if (empty($conf->global->INVOICE_DISABLE_CREDIT_NOTE))
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" id="radio_creditnote" name="type" value="2"' . (GETPOST('type') == 2 ? ' checked' : '');
|
||||
@@ -2337,19 +2339,20 @@ if ($action == 'create')
|
||||
$text .= '</select>';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
print $desc;
|
||||
|
||||
|
||||
print '<div id="credit_note_options" class="clearboth">';
|
||||
print ' <input data-role="none" type="checkbox" name="invoiceAvoirWithLines" id="invoiceAvoirWithLines" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithPaymentRestAmount\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithLines','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithLines">'.$langs->trans('invoiceAvoirWithLines')."</label>";
|
||||
print '<br> <input data-role="none" type="checkbox" name="invoiceAvoirWithPaymentRestAmount" id="invoiceAvoirWithPaymentRestAmount" value="1" onclick="if($(this).is(\':checked\') ) { $(\'#radio_creditnote\').prop(\'checked\', true); $(\'#invoiceAvoirWithLines\').removeAttr(\'checked\'); }" '.(GETPOST('invoiceAvoirWithPaymentRestAmount','int')>0 ? 'checked':'').' /> <label for="invoiceAvoirWithPaymentRestAmount">'.$langs->trans('invoiceAvoirWithPaymentRestAmount')."</label>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '</div></div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
|
||||
$tmp='<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
|
||||
if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp='<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
|
||||
else $tmp='<input type="radio" name="type" id="radio_creditnote" value="2" > ';
|
||||
$text = $tmp.$langs->trans("InvoiceAvoir") . ' ';
|
||||
$text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') ';
|
||||
$desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceAvoirDesc"), 1, 'help', '', 0, 3);
|
||||
@@ -3744,7 +3747,9 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '</td>';
|
||||
if ($action != 'classify') {
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=classify&facid=' . $object->id . '">';
|
||||
print img_edit($langs->trans('SetProject'), 1);
|
||||
if ($user->rights->facture->creer) {
|
||||
print img_edit($langs->trans('SetProject'), 1);
|
||||
}
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
||||
@@ -392,7 +392,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
// Update ref with new one
|
||||
$this->ref='(PROV'.$this->id.')';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->ref."' WHERE rowid=".$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);
|
||||
@@ -1164,7 +1164,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$this->lines=array();
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
|
||||
$sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
|
||||
$sql.= ' l.situation_percent, l.fk_prev_id,';
|
||||
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
|
||||
$sql.= ' l.rang, l.special_code,';
|
||||
@@ -1191,6 +1191,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
$line->id = $objp->rowid;
|
||||
$line->rowid = $objp->rowid; // deprecated
|
||||
$line->fk_facture = $objp->fk_facture;
|
||||
$line->label = $objp->custom_label; // deprecated
|
||||
$line->desc = $objp->description; // Description line
|
||||
$line->description = $objp->description; // Description line
|
||||
@@ -1443,6 +1444,18 @@ class Facture extends CommonInvoice
|
||||
$facligne->rang=-1;
|
||||
$facligne->info_bits=2;
|
||||
|
||||
// Get buy/cost price of invoice that is source of discount
|
||||
if ($remise->fk_facture_source > 0)
|
||||
{
|
||||
$srcinvoice=new Facture($this->db);
|
||||
$srcinvoice->fetch($remise->fk_facture_source);
|
||||
$totalcostpriceofinvoice=0;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; // TODO Move this into commonobject
|
||||
$formmargin=new FormMargin($this->db);
|
||||
$arraytmp=$formmargin->getMarginInfosArray($srcinvoice, false);
|
||||
$facligne->pa_ht = $arraytmp['pa_total'];
|
||||
}
|
||||
|
||||
$facligne->total_ht = -$remise->amount_ht;
|
||||
$facligne->total_tva = -$remise->amount_tva;
|
||||
$facligne->total_ttc = -$remise->amount_ttc;
|
||||
@@ -2469,7 +2482,7 @@ class Facture extends CommonInvoice
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @return int < 0 if KO, > 0 if OK
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=0, $fk_unit = null)
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=100, $fk_unit = null)
|
||||
{
|
||||
global $conf,$user;
|
||||
// Deprecation warning
|
||||
@@ -3003,7 +3016,8 @@ class Facture extends CommonInvoice
|
||||
* set up mask.
|
||||
*/
|
||||
if ($mode != 'last' && !$numref) {
|
||||
dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error);
|
||||
$this->error=$obj->error;
|
||||
//dol_print_error($this->db,"Facture::getNextNumRef ".$obj->error);
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -4083,10 +4097,11 @@ class FactureLigne extends CommonInvoiceLine
|
||||
/**
|
||||
* Insert line into database
|
||||
*
|
||||
* @param int $notrigger 1 no triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param int $notrigger 1 no triggers
|
||||
* @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function insert($notrigger=0)
|
||||
function insert($notrigger=0, $noerrorifdiscountalreadylinked=0)
|
||||
{
|
||||
global $langs,$user,$conf;
|
||||
|
||||
@@ -4230,13 +4245,16 @@ class FactureLigne extends CommonInvoiceLine
|
||||
// Check if discount was found
|
||||
if ($result > 0)
|
||||
{
|
||||
// Check if discount not already affected to another invoice
|
||||
if ($discount->fk_facture)
|
||||
// Check if discount not already affected to another invoice
|
||||
if ($discount->fk_facture_line > 0)
|
||||
{
|
||||
$this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id);
|
||||
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
if (empty($noerrorifdiscountalreadylinked))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorDiscountAlreadyUsed",$discount->id);
|
||||
dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4357,14 +4375,14 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql.= ",tva_tx=".price2num($this->tva_tx)."";
|
||||
$sql.= ",localtax1_tx=".price2num($this->localtax1_tx)."";
|
||||
$sql.= ",localtax2_tx=".price2num($this->localtax2_tx)."";
|
||||
$sql.= ",localtax1_type='".$this->localtax1_type."'";
|
||||
$sql.= ",localtax2_type='".$this->localtax2_type."'";
|
||||
$sql.= ",localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
||||
$sql.= ",localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||
$sql.= ",qty=".price2num($this->qty)."";
|
||||
$sql.= ",date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null");
|
||||
$sql.= ",date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null");
|
||||
$sql.= ",product_type=".$this->product_type;
|
||||
$sql.= ",info_bits='".$this->info_bits."'";
|
||||
$sql.= ",special_code='".$this->special_code."'";
|
||||
$sql.= ",info_bits='".$this->db->escape($this->info_bits)."'";
|
||||
$sql.= ",special_code='".$this->db->escape($this->special_code)."'";
|
||||
if (empty($this->skip_update_total))
|
||||
{
|
||||
$sql.= ",total_ht=".price2num($this->total_ht)."";
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -161,6 +162,6 @@ else
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
@@ -124,6 +124,10 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('socid' => $socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
// Set note
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||
|
||||
@@ -892,14 +896,14 @@ if ($action == 'create')
|
||||
$langs->load('projects');
|
||||
print '<tr><td>' . $langs->trans('Project') . '</td><td>';
|
||||
$numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id).'">' . $langs->trans("AddProject") . '</a>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Bank account
|
||||
if ($object->fk_account > 0)
|
||||
{
|
||||
print "<tr><td>".$langs->trans('BankAccount')."</td><td>";
|
||||
print "<tr><td>".$langs->trans('RIB')."</td><td>";
|
||||
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
|
||||
print "</td></tr>";
|
||||
}
|
||||
@@ -959,7 +963,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";
|
||||
@@ -1111,7 +1115,7 @@ else
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Project');
|
||||
print '</td>';
|
||||
if ($action != 'classify') {
|
||||
if ($action != 'classify' && $user->rights->facture->creer) {
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=classify&facid=' . $object->id . '">';
|
||||
print img_edit($langs->trans('SetProject'), 1);
|
||||
print '</a></td>';
|
||||
@@ -1129,9 +1133,11 @@ else
|
||||
}
|
||||
|
||||
// Bank Account
|
||||
$langs->load('banks');
|
||||
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print $langs->trans('RIB');
|
||||
print '<td>';
|
||||
if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon))
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
@@ -1301,7 +1307,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
|
||||
@@ -1312,7 +1318,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
|
||||
@@ -1384,8 +1390,14 @@ else
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,";
|
||||
$sql.= " f.date_last_gen, f.date_when";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency);
|
||||
|
||||
@@ -201,7 +201,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
|
||||
$search_state="";
|
||||
$search_type='';
|
||||
$search_country='';
|
||||
$search_type_thirdparty='';
|
||||
$search_type_thirdparty='';
|
||||
$day='';
|
||||
$year='';
|
||||
$month='';
|
||||
@@ -228,7 +228,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error && $massaction == 'confirm_presend' && GETPOST('modelselected')) // If we change the template, we must not send email, but keep on send email form
|
||||
{
|
||||
$massaction='presend';
|
||||
@@ -240,7 +240,7 @@ if (empty($reshook))
|
||||
$nbignored = 0;
|
||||
$langs->load("mails");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
if (!$error && !isset($user->email))
|
||||
{
|
||||
$error++;
|
||||
@@ -258,7 +258,7 @@ if (empty($reshook))
|
||||
{
|
||||
$objecttmp=new Facture($db); // must create new instance because instance is saved into $listofobjectref array for future use
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
if ($result > 0)
|
||||
{
|
||||
$listoinvoicesid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
@@ -267,16 +267,16 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
//var_dump($listofobjectthirdparties);exit;
|
||||
|
||||
|
||||
foreach ($listofobjectthirdparties as $thirdpartyid)
|
||||
{
|
||||
$result = $thirdparty->fetch($thirdpartyid);
|
||||
if ($result < 0)
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Define recipient $sendto and $sendtocc
|
||||
if (trim($_POST['sendto']))
|
||||
{
|
||||
@@ -314,9 +314,9 @@ if (empty($reshook))
|
||||
$sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//var_dump($listofobjectref[$thirdpartyid]); // Array of invoice for this thirdparty
|
||||
|
||||
|
||||
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
||||
$listofqualifiedinvoice=array();
|
||||
$listofqualifiedref=array();
|
||||
@@ -324,14 +324,14 @@ if (empty($reshook))
|
||||
{
|
||||
//var_dump($object);
|
||||
//var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut);
|
||||
|
||||
|
||||
if ($object->statut != Facture::STATUS_VALIDATED)
|
||||
{
|
||||
$nbignored++;
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'</div><br>';
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
|
||||
|
||||
// Read document
|
||||
// TODO Use future field $object->fullpathdoc to know where is stored default file
|
||||
// TODO If not defined, use $object->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc.
|
||||
@@ -347,39 +347,39 @@ if (empty($reshook))
|
||||
$object->fetch_thirdparty();
|
||||
$sendto = $object->thirdparty->email;
|
||||
}
|
||||
|
||||
if (empty($sendto))
|
||||
|
||||
if (empty($sendto))
|
||||
{
|
||||
//print "No recipient for thirdparty ".$object->thirdparty->name;
|
||||
$nbignored++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (dol_strlen($sendto))
|
||||
{
|
||||
// Create form object
|
||||
$attachedfiles=array(
|
||||
'paths'=>array_merge($attachedfiles['paths'],array($file)),
|
||||
'names'=>array_merge($attachedfiles['names'],array($filename)),
|
||||
'paths'=>array_merge($attachedfiles['paths'],array($file)),
|
||||
'names'=>array_merge($attachedfiles['names'],array($filename)),
|
||||
'mimes'=>array_merge($attachedfiles['mimes'],array($mime))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$listofqualifiedinvoice[$objectid]=$object;
|
||||
$listofqualifiedref[$objectid]=$object->ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$nbignored++;
|
||||
$langs->load("errors");
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorCantReadFile',$file).'</div><br>';
|
||||
dol_syslog('Failed to read file: '.$file, LOG_WARNING);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
//var_dump($listofqualifiedref);
|
||||
}
|
||||
|
||||
|
||||
if (count($listofqualifiedinvoice) > 0)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
@@ -389,7 +389,7 @@ if (empty($reshook))
|
||||
$message = GETPOST('message');
|
||||
$sendtocc = GETPOST('sentocc');
|
||||
$sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO);
|
||||
|
||||
|
||||
$substitutionarray=array(
|
||||
'__ID__' => join(', ',array_keys($listofqualifiedinvoice)),
|
||||
'__EMAIL__' => $thirdparty->email,
|
||||
@@ -400,16 +400,16 @@ if (empty($reshook))
|
||||
'__REF__' => join(', ',$listofqualifiedref),
|
||||
'__REFCLIENT__' => $thirdparty->name
|
||||
);
|
||||
|
||||
|
||||
$subject=make_substitutions($subject, $substitutionarray);
|
||||
$message=make_substitutions($message, $substitutionarray);
|
||||
|
||||
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
|
||||
//var_dump($filepath);
|
||||
|
||||
|
||||
// Send mail
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php');
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1);
|
||||
@@ -423,9 +423,9 @@ if (empty($reshook))
|
||||
if ($result)
|
||||
{
|
||||
$resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'<br>'; // Must not contain "
|
||||
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
// Insert logs into agenda
|
||||
foreach($listofqualifiedinvoice as $invid => $object)
|
||||
{
|
||||
@@ -438,7 +438,7 @@ if (empty($reshook))
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
|
||||
// Initialisation donnees
|
||||
$object->sendtoid = 0;
|
||||
$object->actiontypecode = $actiontypecode;
|
||||
@@ -446,14 +446,14 @@ if (empty($reshook))
|
||||
$object->actionmsg2 = $actionmsg2; // Short text
|
||||
$object->fk_element = $invid;
|
||||
$object->elementtype = $object->element;
|
||||
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('BILL_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
|
||||
if ($error)
|
||||
{
|
||||
setEventMessages($db->lasterror(), $errors, 'errors');
|
||||
@@ -484,7 +484,7 @@ if (empty($reshook))
|
||||
$resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n<br>";
|
||||
$resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n<br>";
|
||||
$resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n<br>";
|
||||
|
||||
|
||||
if ($nbsent)
|
||||
{
|
||||
$action=''; // Do not show form post if there was at least one successfull sent
|
||||
@@ -497,7 +497,7 @@ if (empty($reshook))
|
||||
setEventMessages($resaction, null, 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$action='list';
|
||||
$massaction='';
|
||||
}
|
||||
@@ -507,7 +507,7 @@ if (empty($reshook))
|
||||
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';
|
||||
|
||||
|
||||
$objecttmp=new Facture($db);
|
||||
$listofobjectid=array();
|
||||
$listofobjectthirdparties=array();
|
||||
@@ -542,7 +542,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Define output language (Here it is not used because we do only merging existing PDF)
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
@@ -607,12 +607,12 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Remove file
|
||||
if ($action == 'remove_file')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $diroutputmassaction;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
@@ -621,10 +621,10 @@ if (empty($reshook))
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@@ -650,7 +650,7 @@ $sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name";
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
|
||||
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
@@ -703,7 +703,7 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql.= natural_search('f.total_vat', $search_montant_vat, 1);
|
||||
if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
if ($search_status != '' && $search_status >= 0)
|
||||
{
|
||||
@@ -795,7 +795,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->plimit($limit+1,$offset);
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
//print $sql;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@@ -804,7 +804,7 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
@@ -842,11 +842,12 @@ if ($resql)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
|
||||
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
|
||||
$i = 0;
|
||||
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
@@ -854,14 +855,14 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
|
||||
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$massactionbutton,$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit);
|
||||
|
||||
if ($massaction == 'presend')
|
||||
{
|
||||
$langs->load("mails");
|
||||
|
||||
if (! GETPOST('cancel'))
|
||||
|
||||
if (! GETPOST('cancel'))
|
||||
{
|
||||
$objecttmp=new Facture($db);
|
||||
$listofselectedid=array();
|
||||
@@ -870,7 +871,7 @@ if ($resql)
|
||||
foreach($arrayofselected as $toselectid)
|
||||
{
|
||||
$result=$objecttmp->fetch($toselectid);
|
||||
if ($result > 0)
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofselectedid[$toselectid]=$toselectid;
|
||||
$thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid;
|
||||
@@ -881,10 +882,10 @@ if ($resql)
|
||||
}
|
||||
|
||||
print '<input type="hidden" name="massaction" value="confirm_presend">';
|
||||
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
dol_fiche_head(null, '', '');
|
||||
|
||||
$topicmail="SendBillRef";
|
||||
@@ -949,16 +950,16 @@ if ($resql)
|
||||
//$formmail->param['returnurl']=$_SERVER["PHP_SELF"].'?id='.$object->id;
|
||||
|
||||
print $formmail->get_form();
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
|
||||
}
|
||||
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
$moreforfilter='';
|
||||
if ($user->rights->societe->client->voir || $socid)
|
||||
@@ -1001,9 +1002,9 @@ if ($resql)
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
|
||||
@@ -1046,21 +1047,21 @@ if ($resql)
|
||||
// Filters lines
|
||||
print '<tr class="liste_titre">';
|
||||
// Ref
|
||||
if (! empty($arrayfields['f.facnumber']['checked']))
|
||||
if (! empty($arrayfields['f.facnumber']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Ref customer
|
||||
if (! empty($arrayfields['f.ref_client']['checked']))
|
||||
if (! empty($arrayfields['f.ref_client']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date invoice
|
||||
if (! empty($arrayfields['f.date']['checked']))
|
||||
if (! empty($arrayfields['f.date']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
|
||||
@@ -1069,7 +1070,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Date due
|
||||
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
|
||||
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.$day_lim.'">';
|
||||
@@ -1079,7 +1080,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Thirpdarty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
}
|
||||
@@ -1109,7 +1110,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Payment mode
|
||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="left">';
|
||||
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 0, 1, 10);
|
||||
@@ -1222,21 +1223,21 @@ if ($resql)
|
||||
$totaldeposits = $facturestatic->getSumDepositsUsed();
|
||||
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
|
||||
$remaintopay = $obj->total_ttc - $totalpay;
|
||||
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
if (! empty($arrayfields['f.facnumber']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
|
||||
|
||||
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
|
||||
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $facturestatic->getNomUrl(1,'',200,0,$notetoshow);
|
||||
print $obj->increment;
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
if (! empty($obj->note_private))
|
||||
{
|
||||
@@ -1251,11 +1252,11 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Customer ref
|
||||
if (! empty($arrayfields['f.ref_client']['checked']))
|
||||
{
|
||||
@@ -1264,7 +1265,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Date
|
||||
if (! empty($arrayfields['f.date']['checked']))
|
||||
{
|
||||
@@ -1273,7 +1274,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Date limit
|
||||
if (! empty($arrayfields['f.date_lim_reglement']['checked']))
|
||||
{
|
||||
@@ -1285,7 +1286,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Third party
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
@@ -1339,7 +1340,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Payment mode
|
||||
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
{
|
||||
@@ -1348,7 +1349,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Amount HT
|
||||
if (! empty($arrayfields['f.total_ht']['checked']))
|
||||
{
|
||||
@@ -1389,7 +1390,7 @@ if ($resql)
|
||||
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalrtp'] += $remaintopay;
|
||||
}
|
||||
|
||||
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@@ -1431,12 +1432,12 @@ if ($resql)
|
||||
// Status
|
||||
if (! empty($arrayfields['f.fk_statut']['checked']))
|
||||
{
|
||||
print '<td align="right" class="nowrap">';
|
||||
print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$paiement,$obj->type);
|
||||
print "</td>";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
print '<td align="right" class="nowrap">';
|
||||
print $facturestatic->LibStatut($obj->paye,$obj->fk_statut,5,$paiement,$obj->type);
|
||||
print "</td>";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
$selected=0;
|
||||
@@ -1444,7 +1445,7 @@ if ($resql)
|
||||
print '<input id="cb'.$obj->facid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->facid.'"'.($selected?' checked="checked"':'').'>';
|
||||
print '</td>' ;
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
@@ -1471,20 +1472,20 @@ if ($resql)
|
||||
else print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
||||
{
|
||||
/*
|
||||
@@ -1492,15 +1493,15 @@ if ($resql)
|
||||
*/
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$urlsource.=str_replace('&','&',$param);
|
||||
|
||||
|
||||
$filedir=$diroutputmassaction;
|
||||
$genallowed=$user->rights->facture->lire;
|
||||
$delallowed=$user->rights->facture->lire;
|
||||
|
||||
|
||||
print '<br><a name="show_files"></a>';
|
||||
$paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
|
||||
$title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
|
||||
|
||||
|
||||
print $formfile->showdocuments('massfilesarea_facture','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
|
||||
}
|
||||
else
|
||||
|
||||
@@ -154,12 +154,12 @@ class Localtax extends CommonObject
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||
$sql.= " amount='".$this->amount."',";
|
||||
$sql.= " amount=".price2num($this->amount).",";
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
$sql.= " fk_bank='".$this->fk_bank."',";
|
||||
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
|
||||
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
||||
$sql.= " fk_bank=".$this->fk_bank.",";
|
||||
$sql.= " fk_user_creat=".$this->fk_user_creat.",";
|
||||
$sql.= " fk_user_modif=".$this->fk_user_modif;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
|
||||
@@ -391,10 +391,9 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
var form = $("#payment_form");
|
||||
|
||||
json["invoice_type"] = $("#invoice_type").val();
|
||||
json["amountPayment"] = $("#amountpayment").attr("value");
|
||||
json["amountPayment"] = $("#amountpayment").attr("value");
|
||||
json["amounts"] = _elemToJson(form.find("input.amount"));
|
||||
json["remains"] = _elemToJson(form.find("input.remain]"));
|
||||
|
||||
json["remains"] = _elemToJson(form.find("input.remain"));
|
||||
if (imgId != null) {
|
||||
json["imgClicked"] = imgId;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ class RemiseCheque extends CommonObject
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET ref='(PROV".$this->id.")'";
|
||||
$sql.= " WHERE rowid='".$this->id."';";
|
||||
$sql.= " WHERE rowid=".$this->id."";
|
||||
|
||||
dol_syslog("RemiseCheque::Create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@@ -252,7 +252,7 @@ class BonPrelevement extends CommonObject
|
||||
function getErrorString($error)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
$errors = array();
|
||||
|
||||
$errors[1027] = $langs->trans("DateInvalid");
|
||||
@@ -920,7 +920,7 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
$dir=$conf->prelevement->dir_output.'/receipts';
|
||||
if (! is_dir($dir)) dol_mkdir($dir);
|
||||
|
||||
|
||||
$this->filename = $dir.'/'.$ref.'.xml';
|
||||
|
||||
// Create withdraw receipt in database
|
||||
@@ -1028,7 +1028,7 @@ class BonPrelevement extends CommonObject
|
||||
$this->emetteur_bic = $account->bic;
|
||||
|
||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||
|
||||
|
||||
$this->raison_sociale = $account->proprio;
|
||||
}
|
||||
|
||||
@@ -1272,18 +1272,6 @@ class BonPrelevement extends CommonObject
|
||||
* section Debiteur (sepa Debiteurs bloc lines)
|
||||
*/
|
||||
|
||||
$tmp_invoices = array();
|
||||
|
||||
$sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($objfac = $this->db->fetch_object($resql)) {
|
||||
$tmp_invoices[] = $objfac->fac;
|
||||
}
|
||||
}
|
||||
|
||||
$ListOfFactures = implode($tmp_invoices);
|
||||
|
||||
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
|
||||
@@ -1310,7 +1298,7 @@ class BonPrelevement extends CommonObject
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum);
|
||||
$this->total = $this->total + $obj->somme;
|
||||
$i++;
|
||||
}
|
||||
@@ -1581,11 +1569,11 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' </FinInstnId>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DbtrAgt>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Dbtr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Nm>'.strtoupper(dol_string_unaccent($row_nom)).'</Nm>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Nm>'.strtoupper(dolEscapeXML(dol_string_unaccent($row_nom))).'</Nm>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PstlAdr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dol_string_unaccent($row_zip.' '.$row_town).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_trunc(dol_string_unaccent(strtr($row_address, array(CHR(13) => ", ", CHR(10) => ""))),70,'right','UTF-8',true)).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' <AdrLine>'.dolEscapeXML(dol_string_unaccent($row_zip.' '.$row_town)).'</AdrLine>'.$CrLf;
|
||||
$XML_DEBITOR .=' </PstlAdr>'.$CrLf;
|
||||
$XML_DEBITOR .=' </Dbtr>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DbtrAcct>'.$CrLf;
|
||||
@@ -1680,7 +1668,7 @@ class BonPrelevement extends CommonObject
|
||||
* @return string String with SEPA Sender
|
||||
*/
|
||||
function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n')
|
||||
{
|
||||
{
|
||||
// SEPA INITIALISATION
|
||||
global $conf;
|
||||
|
||||
@@ -1699,12 +1687,12 @@ class BonPrelevement extends CommonObject
|
||||
$this->emetteur_number_key = $account->cle_rib;
|
||||
$this->emetteur_iban = $account->iban;
|
||||
$this->emetteur_bic = $account->bic;
|
||||
|
||||
|
||||
$this->emetteur_ics = $conf->global->PRELEVEMENT_ICS; // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
|
||||
|
||||
|
||||
$this->raison_sociale = $account->proprio;
|
||||
}
|
||||
|
||||
|
||||
// Récupération info demandeur
|
||||
$sql = "SELECT rowid, ref";
|
||||
$sql.= " FROM";
|
||||
|
||||
@@ -97,19 +97,19 @@ class PaymentSalary extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
|
||||
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
$sql.= " fk_user='".$this->fk_user."',";
|
||||
$sql.= " fk_user=".$this->fk_user.",";
|
||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||
$sql.= " amount='".$this->amount."',";
|
||||
$sql.= " amount=".price2num($this->amount).",";
|
||||
$sql.= " fk_typepayment=".$this->fk_typepayment."',";
|
||||
$sql.= " num_payment='".$this->num_payment."',";
|
||||
$sql.= " num_payment='".$this->db->escape($this->num_payment)."',";
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " datesp=".$this->db->idate($this->datesp).",";
|
||||
$sql.= " dateep=".$this->db->idate($this->dateep).",";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
$sql.= " fk_bank=".($this->fk_bank > 0 ? "'".$this->fk_bank."'":"null").",";
|
||||
$sql.= " fk_user_author='".$this->fk_user_author."',";
|
||||
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
||||
$sql.= " fk_user_author=".$this->fk_user_author.",";
|
||||
$sql.= " fk_user_modif=".$this->fk_user_modif;
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ class ChargeSociales extends CommonObject
|
||||
// Delete payments
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge where fk_charge='".$this->id."'";
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge where fk_charge=".$this->id;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
@@ -228,7 +228,7 @@ class ChargeSociales extends CommonObject
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales where rowid='".$this->id."'";
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales where rowid=".$this->id;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
|
||||
@@ -175,12 +175,12 @@ class Tva extends CommonObject
|
||||
$sql.= " tms=".$this->db->idate($this->tms).",";
|
||||
$sql.= " datep=".$this->db->idate($this->datep).",";
|
||||
$sql.= " datev=".$this->db->idate($this->datev).",";
|
||||
$sql.= " amount='".$this->amount."',";
|
||||
$sql.= " amount=".price2num($this->amount).",";
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " note='".$this->db->escape($this->note)."',";
|
||||
$sql.= " fk_bank='".$this->fk_bank."',";
|
||||
$sql.= " fk_user_creat='".$this->fk_user_creat."',";
|
||||
$sql.= " fk_user_modif='".$this->fk_user_modif."'";
|
||||
$sql.= " fk_bank=".$this->fk_bank.",";
|
||||
$sql.= " fk_user_creat=".$this->fk_user_creat.",";
|
||||
$sql.= " fk_user_modif=".$this->fk_user_modif."";
|
||||
|
||||
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
@@ -124,12 +124,13 @@ class Contact extends CommonObject
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
{
|
||||
$sql.= " OUTER JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
|
||||
$sql.= " OUTER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE sp.fk_soc = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$clause = "AND";
|
||||
}
|
||||
$sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')';
|
||||
$sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))";
|
||||
if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@@ -39,7 +39,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contact', $id, '','');
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
|
||||
@@ -129,7 +129,7 @@ $fieldstosearchall = array(
|
||||
$arrayfields=array(
|
||||
'p.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'p.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'p.poste'=>array('label'=>$langs->trans("Post"), 'checked'=>1),
|
||||
'p.poste'=>array('label'=>$langs->trans("PostOrFunction"), 'checked'=>1),
|
||||
'p.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0),
|
||||
'p.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0),
|
||||
'p.phone'=>array('label'=>$langs->trans("PhonePro"), 'checked'=>1),
|
||||
@@ -761,8 +761,10 @@ if ($result)
|
||||
}
|
||||
// Action column - Links Add action and Export vcard
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&contactid='.$obj->cidp.'&socid='.$obj->socid.'">'.img_object($langs->trans("AddAction"),"action").'</a>';
|
||||
print ' ';
|
||||
if ($user->rights->agenda->myactions->create) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&contactid='.$obj->cidp.'&socid='.$obj->socid.'">'.img_object($langs->trans("AddAction"),"action").'</a>';
|
||||
print ' ';
|
||||
}
|
||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$obj->cidp.'">';
|
||||
print img_picto($langs->trans("VCard"),'vcard.png').' ';
|
||||
print '</a></td>';
|
||||
|
||||
@@ -1599,8 +1599,8 @@ class Contrat extends CommonObject
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used
|
||||
{
|
||||
$contractline = new ContratLigne($this->db);
|
||||
$contractline->array_options=$array_option;
|
||||
$contractline->id= $this->db->last_insert_id(MAIN_DB_PREFIX.$contractline->table_element);
|
||||
$contractline->array_options=$array_options;
|
||||
$contractline->id= $rowid;
|
||||
$result=$contractline->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
@@ -2045,7 +2045,7 @@ class Contrat extends CommonObject
|
||||
$sql = "SELECT count(c.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||
if (!$user->rights->contrat->lire && !$user->societe_id)
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql.= " WHERE sc.fk_user = " .$user->id;
|
||||
@@ -2606,9 +2606,9 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
||||
$sql.= " fk_contrat='".$this->fk_contrat."',";
|
||||
$sql.= " fk_contrat=".$this->fk_contrat.",";
|
||||
$sql.= " fk_product=".($this->fk_product?"'".$this->fk_product."'":'null').",";
|
||||
$sql.= " statut='".$this->statut."',";
|
||||
$sql.= " statut=".$this->statut.",";
|
||||
$sql.= " label='".$this->db->escape($this->label)."',";
|
||||
$sql.= " description='".$this->db->escape($this->description)."',";
|
||||
$sql.= " date_commande=".($this->date_commande!=''?"'".$this->db->idate($this->date_commande)."'":"null").",";
|
||||
@@ -2616,23 +2616,23 @@ class ContratLigne extends CommonObjectLine
|
||||
$sql.= " date_ouverture=".($this->date_ouverture!=''?"'".$this->db->idate($this->date_ouverture)."'":"null").",";
|
||||
$sql.= " date_fin_validite=".($this->date_fin_validite!=''?"'".$this->db->idate($this->date_fin_validite)."'":"null").",";
|
||||
$sql.= " date_cloture=".($this->date_cloture!=''?"'".$this->db->idate($this->date_cloture)."'":"null").",";
|
||||
$sql.= " tva_tx='".$this->tva_tx."',";
|
||||
$sql.= " localtax1_tx='".$this->localtax1_tx."',";
|
||||
$sql.= " localtax2_tx='".$this->localtax2_tx."',";
|
||||
$sql.= " qty='".$this->qty."',";
|
||||
$sql.= " remise_percent='".$this->remise_percent."',";
|
||||
$sql.= " tva_tx=".$this->tva_tx.",";
|
||||
$sql.= " localtax1_tx=".$this->localtax1_tx.",";
|
||||
$sql.= " localtax2_tx=".$this->localtax2_tx.",";
|
||||
$sql.= " qty=".$this->qty.",";
|
||||
$sql.= " remise_percent=".$this->remise_percent.",";
|
||||
$sql.= " remise=".($this->remise?"'".$this->remise."'":"null").",";
|
||||
$sql.= " fk_remise_except=".($this->fk_remise_except?"'".$this->fk_remise_except."'":"null").",";
|
||||
$sql.= " subprice=".($this->subprice != '' ? $this->subprice : "null").",";
|
||||
$sql.= " price_ht=".($this->price_ht != '' ? $this->price_ht : "null").",";
|
||||
$sql.= " total_ht='".$this->total_ht."',";
|
||||
$sql.= " total_tva='".$this->total_tva."',";
|
||||
$sql.= " total_localtax1='".$this->total_localtax1."',";
|
||||
$sql.= " total_localtax2='".$this->total_localtax2."',";
|
||||
$sql.= " total_ttc='".$this->total_ttc."',";
|
||||
$sql.= " total_ht=".$this->total_ht.",";
|
||||
$sql.= " total_tva=".$this->total_tva.",";
|
||||
$sql.= " total_localtax1=".$this->total_localtax1.",";
|
||||
$sql.= " total_localtax2=".$this->total_localtax2.",";
|
||||
$sql.= " total_ttc=".$this->total_ttc.",";
|
||||
$sql.= " fk_product_fournisseur_price=".(!empty($this->fk_fournprice)?$this->fk_fournprice:"NULL").",";
|
||||
$sql.= " buy_price_ht='".price2num($this->pa_ht)."',";
|
||||
$sql.= " info_bits='".$this->info_bits."',";
|
||||
$sql.= " info_bits='".$this->db->escape($this->info_bits)."',";
|
||||
$sql.= " fk_user_author=".($this->fk_user_author >= 0?$this->fk_user_author:"NULL").",";
|
||||
$sql.= " fk_user_ouverture=".($this->fk_user_ouverture > 0?$this->fk_user_ouverture:"NULL").",";
|
||||
$sql.= " fk_user_cloture=".($this->fk_user_cloture > 0?$this->fk_user_cloture:"NULL").",";
|
||||
|
||||
@@ -78,8 +78,9 @@ class box_factures_imp extends ModeleBoxes
|
||||
$sql.= " f.total_ttc,";
|
||||
$sql.= " f.paye, f.fk_statut, f.rowid as facid";
|
||||
$sql.= ", sum(pf.amount) as am";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture ";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
|
||||
@@ -70,15 +70,12 @@ class box_services_contracts extends ModeleBoxes
|
||||
$sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,";
|
||||
$sql.= " p.rowid as product_id, p.ref as product_ref";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."contratdet as cd";
|
||||
$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.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
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;
|
||||
$sql.= " AND s.rowid = c.fk_soc";
|
||||
$sql.= " AND c.rowid = cd.fk_contrat";
|
||||
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.= $db->order("c.tms","DESC");
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@@ -104,7 +104,7 @@ class box_services_expired extends ModeleBoxes
|
||||
'logo' => 'company',
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
|
||||
$this->info_box_contents[$i][3] = array('td' => 'class="tdoverflow maxwidth100onsmartphone" align="left"',
|
||||
$this->info_box_contents[$i][3] = array('td' => 'class="tdoverflowmax200 maxwidth100onsmartphone" align="left"',
|
||||
'text' => $objp->name,
|
||||
'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid);
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ class CMailFile
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html.
|
||||
|
||||
|
||||
// Detect images
|
||||
if ($this->msgishtml)
|
||||
{
|
||||
@@ -210,7 +210,7 @@ class CMailFile
|
||||
$this->trackid = $trackid;
|
||||
$smtp_headers = $this->write_smtpheaders();
|
||||
if (! empty($moreinheader)) $smtp_headers.=$moreinheader;
|
||||
|
||||
|
||||
// Define mime_headers
|
||||
$mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list);
|
||||
|
||||
@@ -270,7 +270,7 @@ class CMailFile
|
||||
$smtps->setFrom($this->getValidAddress($from,0,1));
|
||||
$smtps->setTrackId($trackid);
|
||||
$smtps->setReplyTo($this->getValidAddress($from,0,1)); // Set property with this->smtps->setReplyTo after constructor if you want to use another value than the From
|
||||
|
||||
|
||||
if (! empty($this->html))
|
||||
{
|
||||
if (!empty($css))
|
||||
@@ -365,7 +365,9 @@ class CMailFile
|
||||
{
|
||||
// Use Swift Mailer library
|
||||
// ------------------------------------------
|
||||
|
||||
|
||||
$host = dol_getprefix('email');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
|
||||
// Create the message
|
||||
$this->message = Swift_Message::newInstance();
|
||||
@@ -373,7 +375,7 @@ class CMailFile
|
||||
// Adding a trackid header to a message
|
||||
$headers = $this->message->getHeaders();
|
||||
$headers->addTextHeader('X-Dolibarr-TRACKID', $trackid);
|
||||
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $conf->global->MAIN_MAIL_SMTP_SERVER;
|
||||
$headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host;
|
||||
$msgid = $headers->get('Message-ID');
|
||||
$msgid->setId($headerID);
|
||||
$headers->addIdHeader('References', $headerID);
|
||||
@@ -473,16 +475,16 @@ class CMailFile
|
||||
'maildao'
|
||||
));
|
||||
$reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if (! empty($reshook))
|
||||
if (! empty($reshook))
|
||||
{
|
||||
$this->error = "Error in hook maildao doactions " . $reshook;
|
||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR);
|
||||
|
||||
|
||||
return $reshook;
|
||||
}
|
||||
|
||||
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
|
||||
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10;
|
||||
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10;
|
||||
$tmparray1 = explode(',', $this->addr_to);
|
||||
if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)
|
||||
{
|
||||
@@ -490,6 +492,7 @@ class CMailFile
|
||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL=10;
|
||||
$tmparray2 = explode(',', $this->addr_cc);
|
||||
if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)
|
||||
{
|
||||
@@ -497,6 +500,7 @@ class CMailFile
|
||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL=10;
|
||||
$tmparray3 = explode(',', $this->addr_bcc);
|
||||
if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)
|
||||
{
|
||||
@@ -504,14 +508,14 @@ class CMailFile
|
||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10;
|
||||
if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
|
||||
{
|
||||
$this->error = 'Too much recipients in to:, cc:, bcc:';
|
||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Action according to choosed sending method
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
{
|
||||
@@ -553,7 +557,7 @@ class CMailFile
|
||||
$bounce .= ($bounce?' ':'').'-ba';
|
||||
}
|
||||
dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG);
|
||||
|
||||
|
||||
$this->message=stripslashes($this->message);
|
||||
|
||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
|
||||
@@ -873,7 +877,7 @@ class CMailFile
|
||||
|
||||
// Receiver
|
||||
if (isset($this->addr_cc) && $this->addr_cc) $out.= "Cc: ".$this->getValidAddress($this->addr_cc,2).$this->eol2;
|
||||
if (isset($this->addr_bcc) && $this->addr_bcc) $out.= "Bcc: ".$this->getValidAddress($this->addr_bcc,2).$this->eol2; // Question: bcc must not be into header, only into SMTP command "RCPT TO". Does php mail support this ?
|
||||
if (isset($this->addr_bcc) && $this->addr_bcc) $out.= "Bcc: ".$this->getValidAddress($this->addr_bcc,2).$this->eol2; // Question: bcc must not be into header, only into SMTP command "RCPT TO". Does php mail support this ?
|
||||
|
||||
// Delivery receipt
|
||||
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $out.= "Disposition-Notification-To: ".$this->getValidAddress($this->addr_from,2).$this->eol2;
|
||||
|
||||
@@ -2953,24 +2953,31 @@ abstract class CommonObject
|
||||
*/
|
||||
function getTotalWeightVolume()
|
||||
{
|
||||
$weightUnit=0;
|
||||
$volumeUnit=0;
|
||||
$totalWeight = '';
|
||||
$totalVolume = '';
|
||||
$totalOrdered = ''; // defined for shipment only
|
||||
$totalToShip = ''; // defined for shipment only
|
||||
$totalWeight = 0;
|
||||
$totalVolume = 0;
|
||||
// defined for shipment only
|
||||
$totalOrdered = 0;
|
||||
// defined for shipment only
|
||||
$totalToShip = 0;
|
||||
|
||||
foreach ($this->lines as $line)
|
||||
{
|
||||
|
||||
$totalOrdered+=$line->qty_asked; // defined for shipment only
|
||||
$totalToShip+=$line->qty_shipped; // defined for shipment only
|
||||
$totalOrdered+=($line->qty_asked ? $line->qty_asked : 0); // defined for shipment only
|
||||
$totalToShip+=($line->qty_shipped ? $line->qty_shipped : 0); // defined for shipment only
|
||||
|
||||
// Define qty, weight, volume, weight_units, volume_units
|
||||
if ($this->element == 'shipping') {
|
||||
// for shipments
|
||||
$qty = $line->qty_shipped ? $line->qty_shipped : 0;
|
||||
}
|
||||
else {
|
||||
$qty = $line->qty ? $line->qty : 0;
|
||||
}
|
||||
|
||||
$weight = $line->weight ? $line->weight : 0;
|
||||
$volume = $line->volume ? $line->volume : 0;
|
||||
|
||||
// Define qty, weight, volume, weight_units, volume_units
|
||||
if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments
|
||||
else $qty=$line->qty;
|
||||
$weight=$line->weight;
|
||||
$volume=$line->volume;
|
||||
$weight_units=$line->weight_units;
|
||||
$volume_units=$line->volume_units;
|
||||
|
||||
@@ -3073,8 +3080,16 @@ abstract class CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$res = $this->db->fetch_object($resql);
|
||||
return 'Incoterm : '.$res->code.' - '.$this->location_incoterms;
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
$res = $this->db->fetch_object($resql);
|
||||
return 'Incoterm : '.$res->code.' - '.$this->location_incoterms;
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4141,6 +4156,13 @@ abstract class CommonObject
|
||||
foreach($this->array_options as $key => $value)
|
||||
{
|
||||
$attributeKey = substr($key,8); // Remove 'options_' prefix
|
||||
|
||||
// array_option may contain extrafields from an origin object that doesn't exist in current object, we should not try to insert them
|
||||
if(empty($extrafields->attribute_type[$attributeKey])) {
|
||||
unset($this->array_options[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$attributeType = $extrafields->attribute_type[$attributeKey];
|
||||
$attributeLabel = $extrafields->attribute_label[$attributeKey];
|
||||
$attributeParam = $extrafields->attribute_param[$attributeKey];
|
||||
|
||||
@@ -739,7 +739,7 @@ class ExtraFields
|
||||
}
|
||||
elseif ($type == 'varchar')
|
||||
{
|
||||
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="'.$showsize.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'text')
|
||||
{
|
||||
|
||||
@@ -3150,11 +3150,14 @@ class Form
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
} else {
|
||||
|
||||
$langs->load('banks');
|
||||
|
||||
if ($selected) {
|
||||
require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php';
|
||||
$bankstatic=new Account($this->db);
|
||||
$bankstatic->fetch($selected);
|
||||
print $this->textwithpicto($bankstatic->label,$langs->trans("AccountCurrency").' '.$bankstatic->currency_code);
|
||||
print $this->textwithpicto($bankstatic->getNomUrl(1),$langs->trans("AccountCurrency").' '.$bankstatic->currency_code);
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
@@ -5812,7 +5815,7 @@ class Form
|
||||
*/
|
||||
global $dolibarr_main_url_root;
|
||||
$ret.='<!-- Put link to gravatar -->';
|
||||
$ret.='<img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="Gravatar avatar" title="'.$email.' Gravatar avatar" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)),3).'?s='.$width.'&d='.urlencode(dol_buildpath($nophoto,2)).'">'; // gravatar need md5 hash
|
||||
$ret.='<img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="Gravatar avatar" title="'.$email.' Gravatar avatar" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="https://www.gravatar.com/avatar/'.dol_hash(strtolower(trim($email)),3).'?s='.$width.'&d='.urlencode(dol_buildpath($nophoto,3)).'">'; // gravatar need md5 hash
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -76,7 +76,7 @@ class FormFile
|
||||
global $conf,$langs, $hookmanager;
|
||||
$hookmanager->initHooks(array('formfile'));
|
||||
|
||||
|
||||
|
||||
if (! empty($conf->browser->layout) && $conf->browser->layout != 'classic') $useajax=0;
|
||||
|
||||
if ((! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax==2))
|
||||
@@ -89,6 +89,11 @@ class FormFile
|
||||
}
|
||||
else
|
||||
{
|
||||
//If there is no permission and the option to hide unauthorized actions is enabled, then nothing is printed
|
||||
if (!$perm && !empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
$maxlength=$size;
|
||||
|
||||
$out = "\n\n<!-- Start form attach new file -->\n";
|
||||
@@ -276,7 +281,7 @@ class FormFile
|
||||
if (0 !== $iconPDF) {
|
||||
dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING);
|
||||
}
|
||||
|
||||
|
||||
global $langs, $conf, $user, $hookmanager;
|
||||
global $form, $bc;
|
||||
|
||||
@@ -288,7 +293,7 @@ class FormFile
|
||||
if (! empty($iconPDF)) {
|
||||
return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir);
|
||||
}
|
||||
|
||||
|
||||
$printer=0;
|
||||
if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur'))) // The direct print feature is implemented only for such elements
|
||||
{
|
||||
@@ -506,7 +511,7 @@ class FormFile
|
||||
|
||||
$addcolumforpicto=($delallowed || $printer || $morepicto);
|
||||
$out.= '<th align="center" colspan="'.(3+($addcolumforpicto?'2':'1')).'" class="formdoc liste_titre maxwidthonsmartphone">';
|
||||
|
||||
|
||||
// Model
|
||||
if (! empty($modellist))
|
||||
{
|
||||
@@ -604,7 +609,7 @@ class FormFile
|
||||
|
||||
// Show file name with link to download
|
||||
$out.= '<td class="nowrap">';
|
||||
$out.= '<a data-ajax="false" href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).'"';
|
||||
$out.= '<a data-ajax="false" href="'.$documenturl.'?modulepart='.$modulepart.'&file='.urlencode($relativepath).($param?'&'.$param:'').'"';
|
||||
$mime=dol_mimetype($relativepath,'',0);
|
||||
if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
|
||||
$out.= ' target="_blank">';
|
||||
@@ -863,8 +868,8 @@ class FormFile
|
||||
$minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original
|
||||
if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
|
||||
//print $file['path'].'/'.$minifile.'<br>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">';
|
||||
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$minifile).'" title="">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">';
|
||||
print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$minifile).'" title="">';
|
||||
print '</a>';
|
||||
}
|
||||
else print ' ';
|
||||
|
||||
@@ -48,6 +48,7 @@ class FormMargin
|
||||
|
||||
/**
|
||||
* get array with margin information from lines of object
|
||||
* TODO Move this in common class.
|
||||
*
|
||||
* @param CommonObject $object Object we want to get margin information for
|
||||
* @param boolean $force_price True of not
|
||||
@@ -92,19 +93,23 @@ class FormMargin
|
||||
$line->pa_ht = $line->subprice * (1 - ($line->remise_percent / 100));
|
||||
}
|
||||
|
||||
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
$pa_ht = ($pv < 0 ? - $line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
|
||||
$pa = $line->qty * $pa_ht;
|
||||
|
||||
// calcul des marges
|
||||
if (isset($line->fk_remise_except) && isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT)) { // remise
|
||||
$pa = $line->qty * $line->pa_ht;
|
||||
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
if ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1') { // remise globale considérée comme produit
|
||||
$marginInfos['pa_products'] += $pa;
|
||||
$marginInfos['pv_products'] += $pv;
|
||||
$marginInfos['pa_total'] += $pa;
|
||||
$marginInfos['pv_total'] += $pv;
|
||||
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
|
||||
if ($pv < 0)
|
||||
$marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
|
||||
else
|
||||
//if ($pv < 0)
|
||||
//{
|
||||
// $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
|
||||
//}
|
||||
//else
|
||||
$marginInfos['margin_on_products'] += $pv - $pa;
|
||||
}
|
||||
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2') { // remise globale considérée comme service
|
||||
@@ -113,9 +118,9 @@ class FormMargin
|
||||
$marginInfos['pa_total'] += $pa;
|
||||
$marginInfos['pv_total'] += $pv;
|
||||
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
|
||||
if ($pv < 0)
|
||||
$marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
|
||||
else
|
||||
//if ($pv < 0)
|
||||
// $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
|
||||
//else
|
||||
$marginInfos['margin_on_services'] += $pv - $pa;
|
||||
}
|
||||
elseif ($conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3') { // remise globale prise en compte uniqt sur total
|
||||
@@ -126,29 +131,29 @@ class FormMargin
|
||||
else {
|
||||
$type=$line->product_type?$line->product_type:$line->fk_product_type;
|
||||
if ($type == 0) { // product
|
||||
$pa = $line->qty * $line->pa_ht;
|
||||
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pa_products'] += $pa;
|
||||
$marginInfos['pv_products'] += $pv;
|
||||
$marginInfos['pa_total'] += $pa;
|
||||
$marginInfos['pv_total'] += $pv;
|
||||
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
|
||||
if ($pv < 0)
|
||||
$marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
|
||||
else
|
||||
$marginInfos['margin_on_products'] += $pv - $pa;
|
||||
//if ($pv < 0)
|
||||
//{
|
||||
// $marginInfos['margin_on_products'] += -1 * (abs($pv) - $pa);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
$marginInfos['margin_on_products'] += $pv - $pa;
|
||||
//}
|
||||
}
|
||||
elseif ($type == 1) { // service
|
||||
$pa = $line->qty * $line->pa_ht;
|
||||
$pv = $line->qty * $line->subprice * (1 - $line->remise_percent / 100);
|
||||
$marginInfos['pa_services'] += $pa;
|
||||
$marginInfos['pv_services'] += $pv;
|
||||
$marginInfos['pa_total'] += $pa;
|
||||
$marginInfos['pv_total'] += $pv;
|
||||
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
|
||||
if ($pv < 0)
|
||||
$marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
|
||||
else
|
||||
//if ($pv < 0)
|
||||
// $marginInfos['margin_on_services'] += -1 * (abs($pv) - $pa);
|
||||
//else
|
||||
$marginInfos['margin_on_services'] += $pv - $pa;
|
||||
}
|
||||
}
|
||||
@@ -164,9 +169,9 @@ class FormMargin
|
||||
$marginInfos['mark_rate_services'] = 100 * $marginInfos['margin_on_services'] / $marginInfos['pv_services'];
|
||||
|
||||
// if credit note, margin = -1 * (abs(selling_price) - buying_price)
|
||||
if ($marginInfos['pv_total'] < 0)
|
||||
$marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']);
|
||||
else
|
||||
//if ($marginInfos['pv_total'] < 0)
|
||||
// $marginInfos['total_margin'] = -1 * (abs($marginInfos['pv_total']) - $marginInfos['pa_total']);
|
||||
//else
|
||||
$marginInfos['total_margin'] = $marginInfos['pv_total'] - $marginInfos['pa_total'];
|
||||
if ($marginInfos['pa_total'] > 0)
|
||||
$marginInfos['total_margin_rate'] = 100 * $marginInfos['total_margin'] / $marginInfos['pa_total'];
|
||||
|
||||
@@ -140,8 +140,10 @@ class FormProjets
|
||||
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||
if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||
if (!empty($filterkey)) {
|
||||
$sql .= " AND p.title LIKE '%".$this->db->escape($filterkey)."%'";
|
||||
$sql .= " OR p.ref LIKE '%".$this->db->escape($filterkey)."%'";
|
||||
$sql .= ' AND (';
|
||||
$sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"';
|
||||
$sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"';
|
||||
$sql .= ')';
|
||||
}
|
||||
$sql.= " ORDER BY p.ref ASC";
|
||||
|
||||
|
||||
@@ -1190,7 +1190,7 @@ class SMTPs
|
||||
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
|
||||
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
|
||||
|
||||
$host=dol_getprefix('email').'-'.$host;
|
||||
$host=dol_getprefix('email');
|
||||
|
||||
//NOTE: Message-ID should probably contain the username of the user who sent the msg
|
||||
$_header .= 'Subject: ' . $this->getSubject() . "\r\n";
|
||||
|
||||
@@ -442,7 +442,7 @@ class Translate
|
||||
if (! $found)
|
||||
{
|
||||
// Overwrite translation with database read
|
||||
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$this->defaultlang."'";
|
||||
$sql="SELECT transkey, transvalue FROM ".MAIN_DB_PREFIX."overwrite_trans where lang='".$db->escape($this->defaultlang)."'";
|
||||
$resql=$db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
|
||||
@@ -39,7 +39,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
require_once '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
|
||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
|
||||
$langs->load("main");
|
||||
$langs->load("agenda");
|
||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
||||
|
||||
@@ -35,7 +35,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
|
||||
require_once '../main.inc.php';
|
||||
|
||||
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
|
||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
|
||||
$langs->load("main");
|
||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
||||
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@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
|
||||
@@ -407,7 +408,7 @@ function dol_get_next_week($day, $week, $month, $year)
|
||||
{
|
||||
$tmparray = dol_get_first_day_week($day, $month, $year);
|
||||
|
||||
$time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0);
|
||||
$time=dol_mktime(12,0,0,$tmparray['first_month'],$tmparray['first_day'],$tmparray['first_year'],1,0);
|
||||
$time+=24*60*60*7;
|
||||
$tmparray=dol_getdate($time,true);
|
||||
|
||||
|
||||
@@ -868,13 +868,23 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
|
||||
|
||||
$result=0;
|
||||
|
||||
dol_syslog("files.lib.php::dolCopyr srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwriteifexists=".$overwriteifexists);
|
||||
dol_syslog("files.lib.php::dolCopyDir srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwriteifexists=".$overwriteifexists);
|
||||
|
||||
if (empty($srcfile) || empty($destfile)) return -1;
|
||||
|
||||
$destexists=dol_is_dir($destfile);
|
||||
if (! $overwriteifexists && $destexists) return 0;
|
||||
|
||||
|
||||
if (! $destexists)
|
||||
{
|
||||
// We must set mask just before creating dir, becaause it can be set differently by dol_copy
|
||||
umask(0);
|
||||
$dirmaskdec=octdec($newmask);
|
||||
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);
|
||||
$dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files
|
||||
dol_mkdir($destfile."/".$file, '', decoct($dirmaskdec));
|
||||
}
|
||||
|
||||
$srcfile=dol_osencode($srcfile);
|
||||
$destfile=dol_osencode($destfile);
|
||||
|
||||
@@ -891,6 +901,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
|
||||
{
|
||||
if (!is_dir($destfile."/".$file))
|
||||
{
|
||||
// We must set mask just before creating dir, becaause it can be set differently by dol_copy
|
||||
umask(0);
|
||||
$dirmaskdec=octdec($newmask);
|
||||
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);
|
||||
@@ -1055,7 +1066,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
}
|
||||
|
||||
// Security:
|
||||
// On interdit fichiers caches, remontees de repertoire ainsi que les pipes dans les noms de fichiers.
|
||||
// We refuse cache files/dirs, upload using .. and pipes into filenames.
|
||||
if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file))
|
||||
{
|
||||
dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING);
|
||||
@@ -1128,6 +1139,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
* @param int $nohook Disable all hooks
|
||||
* @param object $object Current object in use
|
||||
* @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error
|
||||
* @see dol_delete_dir
|
||||
*/
|
||||
function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null)
|
||||
{
|
||||
@@ -1139,6 +1151,14 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
|
||||
|
||||
dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook);
|
||||
|
||||
// Security:
|
||||
// We refuse transversal using .. and pipes into filenames.
|
||||
if (preg_match('/\.\./',$file) || preg_match('/[<>|]/',$file))
|
||||
{
|
||||
dol_syslog("Refused to delete file ".$file, LOG_WARNING);
|
||||
return False;
|
||||
}
|
||||
|
||||
if (empty($nohook))
|
||||
{
|
||||
$hookmanager->initHooks(array('fileslib'));
|
||||
@@ -1203,9 +1223,18 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
|
||||
* @param string $dir Directory to delete
|
||||
* @param int $nophperrors Disable all PHP output errors
|
||||
* @return boolean True if success, false if error
|
||||
* @see dol_delete_file
|
||||
*/
|
||||
function dol_delete_dir($dir,$nophperrors=0)
|
||||
{
|
||||
// Security:
|
||||
// We refuse transversal using .. and pipes into filenames.
|
||||
if (preg_match('/\.\./',$dir) || preg_match('/[<>|]/',$dir))
|
||||
{
|
||||
dol_syslog("Refused to delete dir ".$dir, LOG_WARNING);
|
||||
return False;
|
||||
}
|
||||
|
||||
$dir_osencoded=dol_osencode($dir);
|
||||
return ($nophperrors?@rmdir($dir_osencoded):rmdir($dir_osencoded));
|
||||
}
|
||||
@@ -1778,7 +1807,8 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta
|
||||
function dol_check_secure_access_document($modulepart,$original_file,$entity,$fuser='',$refname='')
|
||||
{
|
||||
global $user, $conf, $db;
|
||||
|
||||
global $dolibarr_main_data_root;
|
||||
|
||||
if (! is_object($fuser)) $fuser=$user;
|
||||
|
||||
if (empty($modulepart)) return 'ErrorBadParameter';
|
||||
@@ -1792,120 +1822,122 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
// find the subdirectory name as the reference
|
||||
if (empty($refname)) $refname=basename(dirname($original_file)."/");
|
||||
|
||||
$relative_original_file = $original_file;
|
||||
|
||||
// Wrapping for some images
|
||||
if ($modulepart == 'companylogo')
|
||||
if ($modulepart == 'companylogo' && !empty($conf->mycompany->dir_output))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->mycompany->dir_output.'/logos/'.$original_file;
|
||||
}
|
||||
// Wrapping for users photos
|
||||
elseif ($modulepart == 'userphoto')
|
||||
elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->user->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping for members photos
|
||||
elseif ($modulepart == 'memberphoto')
|
||||
elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->adherent->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu factures
|
||||
elseif ($modulepart == 'apercufacture')
|
||||
elseif ($modulepart == 'apercufacture' && !empty($conf->facture->dir_output))
|
||||
{
|
||||
if ($fuser->rights->facture->lire) $accessallowed=1;
|
||||
$original_file=$conf->facture->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu propal
|
||||
elseif ($modulepart == 'apercupropal')
|
||||
elseif ($modulepart == 'apercupropal' && !empty($conf->propal->dir_output))
|
||||
{
|
||||
if ($fuser->rights->propale->lire) $accessallowed=1;
|
||||
$original_file=$conf->propal->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu commande
|
||||
elseif ($modulepart == 'apercucommande')
|
||||
elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output))
|
||||
{
|
||||
if ($fuser->rights->commande->lire) $accessallowed=1;
|
||||
$original_file=$conf->commande->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les apercu intervention
|
||||
elseif ($modulepart == 'apercufichinter')
|
||||
elseif ($modulepart == 'apercufichinter' && !empty($conf->ficheinter->dir_output))
|
||||
{
|
||||
if ($fuser->rights->ficheinter->lire) $accessallowed=1;
|
||||
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats propales
|
||||
elseif ($modulepart == 'propalstats')
|
||||
elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->propale->lire) $accessallowed=1;
|
||||
$original_file=$conf->propal->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats commandes
|
||||
elseif ($modulepart == 'orderstats')
|
||||
elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->commande->lire) $accessallowed=1;
|
||||
$original_file=$conf->commande->dir_temp.'/'.$original_file;
|
||||
}
|
||||
elseif ($modulepart == 'orderstatssupplier')
|
||||
elseif ($modulepart == 'orderstatssupplier' && !empty($conf->fournisseur->dir_output))
|
||||
{
|
||||
if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1;
|
||||
$original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats factures
|
||||
elseif ($modulepart == 'billstats')
|
||||
elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->facture->lire) $accessallowed=1;
|
||||
$original_file=$conf->facture->dir_temp.'/'.$original_file;
|
||||
}
|
||||
elseif ($modulepart == 'billstatssupplier')
|
||||
elseif ($modulepart == 'billstatssupplier' && !empty($conf->fournisseur->dir_output))
|
||||
{
|
||||
if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1;
|
||||
$original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats expeditions
|
||||
elseif ($modulepart == 'expeditionstats')
|
||||
elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->expedition->lire) $accessallowed=1;
|
||||
$original_file=$conf->expedition->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats expeditions
|
||||
elseif ($modulepart == 'tripsexpensesstats')
|
||||
elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->deplacement->lire) $accessallowed=1;
|
||||
$original_file=$conf->deplacement->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats expeditions
|
||||
elseif ($modulepart == 'memberstats')
|
||||
elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->adherent->lire) $accessallowed=1;
|
||||
$original_file=$conf->adherent->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images des stats produits
|
||||
elseif (preg_match('/^productstats_/i',$modulepart))
|
||||
elseif (preg_match('/^productstats_/i',$modulepart) && !empty($conf->product->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->produit->lire || $fuser->rights->service->lire) $accessallowed=1;
|
||||
$original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file;
|
||||
}
|
||||
// Wrapping for products or services
|
||||
elseif ($modulepart == 'tax')
|
||||
elseif ($modulepart == 'tax' && !empty($conf->tax->dir_output))
|
||||
{
|
||||
if ($fuser->rights->tax->charges->lire) $accessallowed=1;
|
||||
$original_file=$conf->tax->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping for products or services
|
||||
elseif ($modulepart == 'actions')
|
||||
elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output))
|
||||
{
|
||||
if ($fuser->rights->agenda->myactions->read) $accessallowed=1;
|
||||
$original_file=$conf->agenda->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping for categories
|
||||
elseif ($modulepart == 'category')
|
||||
elseif ($modulepart == 'category' && !empty($conf->categorie->dir_output))
|
||||
{
|
||||
if ($fuser->rights->categorie->lire) $accessallowed=1;
|
||||
$original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les prelevements
|
||||
elseif ($modulepart == 'prelevement')
|
||||
elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output))
|
||||
{
|
||||
if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -1914,19 +1946,19 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$original_file=$conf->prelevement->dir_output.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les graph energie
|
||||
elseif ($modulepart == 'graph_stock')
|
||||
elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->stock->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les graph fournisseurs
|
||||
elseif ($modulepart == 'graph_fourn')
|
||||
elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->fournisseur->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les graph des produits
|
||||
elseif ($modulepart == 'graph_product')
|
||||
elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->product->multidir_temp[$entity].'/'.$original_file;
|
||||
@@ -1935,32 +1967,31 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
elseif ($modulepart == 'barcode')
|
||||
{
|
||||
$accessallowed=1;
|
||||
// If viewimage is called for barcode, we try to output an image on the fly,
|
||||
// with not build of file on disk.
|
||||
// If viewimage is called for barcode, we try to output an image on the fly, with no build of file on disk.
|
||||
//$original_file=$conf->barcode->dir_temp.'/'.$original_file;
|
||||
$original_file='';
|
||||
}
|
||||
// Wrapping pour les icones de background des mailings
|
||||
elseif ($modulepart == 'iconmailing')
|
||||
elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->mailing->dir_temp.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les icones de background des mailings
|
||||
elseif ($modulepart == 'scanner_user_temp')
|
||||
// Wrapping pour le scanner
|
||||
elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file;
|
||||
}
|
||||
// Wrapping pour les images fckeditor
|
||||
elseif ($modulepart == 'fckeditor')
|
||||
elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->fckeditor->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for third parties
|
||||
else if ($modulepart == 'company' || $modulepart == 'societe')
|
||||
else if (($modulepart == 'company' || $modulepart == 'societe') && !empty($conf->societe->dir_output))
|
||||
{
|
||||
if ($fuser->rights->societe->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -1971,7 +2002,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping for contact
|
||||
else if ($modulepart == 'contact')
|
||||
else if ($modulepart == 'contact' && !empty($conf->societe->dir_output))
|
||||
{
|
||||
if ($fuser->rights->societe->lire)
|
||||
{
|
||||
@@ -1981,7 +2012,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping for invoices
|
||||
else if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
else if (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->dir_output))
|
||||
{
|
||||
if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -1990,7 +2021,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$original_file=$conf->facture->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
else if ($modulepart == 'massfilesarea_facture')
|
||||
else if ($modulepart == 'massfilesarea_facture' && !empty($conf->facture->dir_output))
|
||||
{
|
||||
if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -1999,8 +2030,8 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour les fiches intervention
|
||||
else if ($modulepart == 'ficheinter')
|
||||
// Wrapping for interventions
|
||||
else if (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output))
|
||||
{
|
||||
if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2011,7 +2042,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les deplacements et notes de frais
|
||||
else if ($modulepart == 'deplacement')
|
||||
else if ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output))
|
||||
{
|
||||
if ($fuser->rights->deplacement->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2021,7 +2052,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
// Wrapping pour les propales
|
||||
else if ($modulepart == 'propal')
|
||||
else if ($modulepart == 'propal' && !empty($conf->propal->dir_output))
|
||||
{
|
||||
if ($fuser->rights->propale->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2033,7 +2064,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les commandes
|
||||
else if ($modulepart == 'commande' || $modulepart == 'order')
|
||||
else if (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->dir_output))
|
||||
{
|
||||
if ($fuser->rights->commande->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2044,7 +2075,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les projets
|
||||
else if ($modulepart == 'project')
|
||||
else if ($modulepart == 'project' && !empty($conf->projet->dir_output))
|
||||
{
|
||||
if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2053,7 +2084,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$original_file=$conf->projet->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
else if ($modulepart == 'project_task')
|
||||
else if ($modulepart == 'project_task' && !empty($conf->projet->dir_output))
|
||||
{
|
||||
if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2062,19 +2093,9 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$original_file=$conf->projet->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
// Wrapping for interventions
|
||||
else if ($modulepart == 'fichinter')
|
||||
{
|
||||
if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
}
|
||||
|
||||
// Wrapping pour les commandes fournisseurs
|
||||
else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier')
|
||||
else if (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output))
|
||||
{
|
||||
if ($fuser->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2085,7 +2106,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les factures fournisseurs
|
||||
else if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier')
|
||||
else if (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output))
|
||||
{
|
||||
if ($fuser->rights->fournisseur->facture->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2096,7 +2117,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les rapport de paiements
|
||||
else if ($modulepart == 'facture_paiement')
|
||||
else if ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output))
|
||||
{
|
||||
if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2107,7 +2128,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping for accounting exports
|
||||
else if ($modulepart == 'export_compta')
|
||||
else if ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output))
|
||||
{
|
||||
if ($fuser->rights->accounting->ventilation->dispatch || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2117,7 +2138,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les expedition
|
||||
else if ($modulepart == 'expedition')
|
||||
else if ($modulepart == 'expedition' && !empty($conf->expedition->dir_output))
|
||||
{
|
||||
if ($fuser->rights->expedition->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2127,7 +2148,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les bons de livraison
|
||||
else if ($modulepart == 'livraison')
|
||||
else if ($modulepart == 'livraison' && !empty($conf->expedition->dir_output))
|
||||
{
|
||||
if ($fuser->rights->expedition->livraison->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2137,7 +2158,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les actions
|
||||
else if ($modulepart == 'actions')
|
||||
else if ($modulepart == 'actions' && !empty($conf->agenda->dir_output))
|
||||
{
|
||||
if ($fuser->rights->agenda->myactions->read || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2147,7 +2168,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les actions
|
||||
else if ($modulepart == 'actionsreport')
|
||||
else if ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp))
|
||||
{
|
||||
if ($fuser->rights->agenda->allactions->read || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2168,7 +2189,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les contrats
|
||||
else if ($modulepart == 'contract')
|
||||
else if ($modulepart == 'contract' && !empty($conf->contrat->dir_output))
|
||||
{
|
||||
if ($fuser->rights->contrat->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2178,7 +2199,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les dons
|
||||
else if ($modulepart == 'donation')
|
||||
else if ($modulepart == 'donation' && !empty($conf->don->dir_output))
|
||||
{
|
||||
if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2188,7 +2209,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour les remises de cheques
|
||||
else if ($modulepart == 'remisecheque')
|
||||
else if ($modulepart == 'remisecheque' && !empty($conf->banque->dir_output))
|
||||
{
|
||||
if ($fuser->rights->banque->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2199,7 +2220,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping for bank
|
||||
else if ($modulepart == 'bank')
|
||||
else if ($modulepart == 'bank' && !empty($conf->bank->dir_output))
|
||||
{
|
||||
if ($fuser->rights->banque->lire)
|
||||
{
|
||||
@@ -2209,7 +2230,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping for export module
|
||||
else if ($modulepart == 'export')
|
||||
else if ($modulepart == 'export' && !empty($conf->export->dir_temp))
|
||||
{
|
||||
// Aucun test necessaire car on force le rep de download sur
|
||||
// le rep export qui est propre a l'utilisateur
|
||||
@@ -2218,47 +2239,42 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping for import module
|
||||
else if ($modulepart == 'import')
|
||||
else if ($modulepart == 'import' && !empty($conf->import->dir_temp))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->import->dir_temp.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour l'editeur wysiwyg
|
||||
else if ($modulepart == 'editor')
|
||||
else if ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->fckeditor->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for miscellaneous medias files
|
||||
elseif ($modulepart == 'medias')
|
||||
elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
|
||||
{
|
||||
$accessallowed=1;
|
||||
global $dolibarr_main_data_root;
|
||||
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for backups
|
||||
else if ($modulepart == 'systemtools')
|
||||
else if ($modulepart == 'systemtools' && !empty($conf->admin->dir_output))
|
||||
{
|
||||
if ($fuser->admin)
|
||||
{
|
||||
$accessallowed=1;
|
||||
}
|
||||
if ($fuser->admin) $accessallowed=1;
|
||||
$original_file=$conf->admin->dir_output.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping for upload file test
|
||||
else if ($modulepart == 'admin_temp')
|
||||
else if ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp))
|
||||
{
|
||||
if ($fuser->admin)
|
||||
$accessallowed=1;
|
||||
if ($fuser->admin) $accessallowed=1;
|
||||
$original_file=$conf->admin->dir_temp.'/'.$original_file;
|
||||
}
|
||||
|
||||
// Wrapping pour BitTorrent
|
||||
else if ($modulepart == 'bittorrent')
|
||||
else if ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$dir='files';
|
||||
@@ -2267,7 +2283,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping pour Foundation module
|
||||
else if ($modulepart == 'member')
|
||||
else if ($modulepart == 'member' && !empty($conf->adherent->dir_output))
|
||||
{
|
||||
if ($fuser->rights->adherent->lire || preg_match('/^specimen/i',$original_file))
|
||||
{
|
||||
@@ -2277,7 +2293,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
}
|
||||
|
||||
// Wrapping for Scanner
|
||||
else if ($modulepart == 'scanner_user_temp')
|
||||
else if ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp))
|
||||
{
|
||||
$accessallowed=1;
|
||||
$original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file;
|
||||
@@ -2290,20 +2306,38 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
// If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart
|
||||
else
|
||||
{
|
||||
if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a file called specimen. Test must be done before changing $original_file int full path.
|
||||
if ($fuser->admin) $accessallowed=1; // If user is admin
|
||||
|
||||
// Define $accessallowed
|
||||
if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg))
|
||||
{
|
||||
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
|
||||
if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported
|
||||
{
|
||||
dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')');
|
||||
exit;
|
||||
}
|
||||
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
|
||||
$original_file=$conf->{$reg[1]}->dir_temp.'/'.$fuser->id.'/'.$original_file;
|
||||
}
|
||||
else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg))
|
||||
{
|
||||
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
|
||||
if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported
|
||||
{
|
||||
dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')');
|
||||
exit;
|
||||
}
|
||||
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
|
||||
$original_file=$conf->{$reg[1]}->dir_temp.'/'.$original_file;
|
||||
}
|
||||
else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg))
|
||||
{
|
||||
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
|
||||
if (empty($conf->{$reg[1]}->dir_output)) // modulepart not supported
|
||||
{
|
||||
dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')');
|
||||
exit;
|
||||
}
|
||||
if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1;
|
||||
$original_file=$conf->{$reg[1]}->dir_output.'/'.$fuser->id.'/'.$original_file;
|
||||
}
|
||||
else
|
||||
@@ -2327,8 +2361,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$original_file=$conf->$modulepart->dir_output.'/'.$original_file;
|
||||
}
|
||||
}
|
||||
if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a specimen
|
||||
if ($fuser->admin) $accessallowed=1; // If user is admin
|
||||
|
||||
// For modules who wants to manage different levels of permissions for documents
|
||||
$subPermCategoryConstName = strtoupper($modulepart).'_SUBPERMCATEGORY_FOR_DOCUMENTS';
|
||||
|
||||
@@ -191,7 +191,7 @@ function getBrowserInfo($user_agent)
|
||||
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='opera'; $version=$reg[2]; }
|
||||
elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end
|
||||
elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { $name='lynxlinks'; $version=$reg[4]; }
|
||||
|
||||
|
||||
if ($tablet) {
|
||||
$layout = 'tablet';
|
||||
} elseif ($phone) {
|
||||
@@ -250,6 +250,9 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
|
||||
case 'int':
|
||||
if (! is_numeric($out)) { $out=''; }
|
||||
break;
|
||||
case 'intcomma':
|
||||
if (preg_match('/[^0-9,]+/i',$out)) $out='';
|
||||
break;
|
||||
case 'alpha':
|
||||
$out=trim($out);
|
||||
// '"' is dangerous because param in url can close the href= or src= and add javascript functions.
|
||||
@@ -266,7 +269,7 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
|
||||
break;
|
||||
case 'aZ09':
|
||||
$out=trim($out);
|
||||
if (preg_match('/[^a-z0-9]+/i',$out)) $out='';
|
||||
if (preg_match('/[^a-z0-9_\-]+/i',$out)) $out='';
|
||||
break;
|
||||
case 'array':
|
||||
if (! is_array($out) || empty($out)) $out=array();
|
||||
@@ -287,13 +290,13 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
|
||||
* This prefix is unique for instance and avoid conflict between multi-instances,
|
||||
* even when having two instances with one root dir or two instances in virtual servers
|
||||
*
|
||||
* @param string $mode '' or 'email'
|
||||
* @param string $mode '' or 'email'
|
||||
* @return string A calculated prefix
|
||||
*/
|
||||
function dol_getprefix($mode='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email
|
||||
if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID))
|
||||
{
|
||||
@@ -375,15 +378,15 @@ function dol_buildpath($path, $type=0)
|
||||
if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value
|
||||
if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value
|
||||
if ($type == 3) $res = DOL_URL_ROOT.'/'.$path;
|
||||
|
||||
|
||||
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
|
||||
{
|
||||
if ($key == 'main')
|
||||
if ($key == 'main')
|
||||
{
|
||||
if ($type == 3)
|
||||
{
|
||||
global $dolibarr_main_url_root;
|
||||
|
||||
|
||||
// Define $urlwithroot
|
||||
$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
|
||||
@@ -410,12 +413,12 @@ function dol_buildpath($path, $type=0)
|
||||
if ($type == 3)
|
||||
{
|
||||
global $dolibarr_main_url_root;
|
||||
|
||||
|
||||
// Define $urlwithroot
|
||||
$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
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
|
||||
$res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':$urlwithroot).$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax
|
||||
}
|
||||
break;
|
||||
@@ -954,7 +957,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
|
||||
if ($conf->browser->phone) $maxvisiblephotos=1;
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos($conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
else
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
|
||||
$nophoto='';
|
||||
@@ -964,17 +967,17 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
$nophoto='/public/theme/common/nophoto.png';
|
||||
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos).'</div>';
|
||||
}
|
||||
if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
|
||||
if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
||||
$morehtmlright.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
|
||||
}
|
||||
}
|
||||
elseif ($object->element == 'product')
|
||||
{
|
||||
//$morehtmlright.=$langs->trans("Status").' ('.$langs->trans("Sell").') ';
|
||||
@@ -996,7 +999,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
}
|
||||
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
|
||||
if (! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>'; // For product
|
||||
if ($object->element != 'product')
|
||||
if ($object->element != 'product')
|
||||
{
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
$morehtmlref.=$object->getBannerAddress('refaddress',$object);
|
||||
@@ -1181,9 +1184,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
||||
$reduceformat=(! empty($conf->dol_optimize_smallscreen) && in_array($format,array('day','dayhour')))?1:0;
|
||||
$formatwithoutreduce = preg_replace('/reduceformat/','',$format);
|
||||
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat=1; } // so format 'dayreduceformat' is processed like day
|
||||
|
||||
|
||||
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
|
||||
// TODO Add format daysmallyear and dayhoursmallyear
|
||||
// TODO Add format daysmallyear and dayhoursmallyear
|
||||
if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short);
|
||||
else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short);
|
||||
else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration);
|
||||
@@ -1954,7 +1957,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
|
||||
print '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) return;
|
||||
$jsgraphlib='flot';
|
||||
$datacolor=array();
|
||||
@@ -2123,7 +2126,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
||||
global $conf;
|
||||
|
||||
if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
|
||||
|
||||
|
||||
if (empty($stringencoding)) $stringencoding='UTF-8';
|
||||
// reduce for small screen
|
||||
if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3);
|
||||
@@ -3073,7 +3076,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois
|
||||
* @param string $options parametres complementaires lien ('' par defaut)
|
||||
* @param string $sortfield champ de tri ('' par defaut)
|
||||
* @param string $sortorder ordre de tri ('' par defaut)
|
||||
* @param string $center chaine du centre ('' par defaut). We often find here string $massaction comming from $form->selectMassAction()
|
||||
* @param string $center chaine du centre ('' par defaut). We often find here string $massaction comming from $form->selectMassAction()
|
||||
* @param int $num number of records found by select with limit+1
|
||||
* @param int $totalnboflines Total number of records/lines for all pages (if known). Use a negative value to no show number.
|
||||
* @param string $picto Icon to use before title (should be a 32x32 transparent png file)
|
||||
@@ -3087,11 +3090,11 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois
|
||||
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
|
||||
$savlimit = $limit;
|
||||
$savtotalnboflines = $totalnboflines;
|
||||
$totalnboflines=abs($totalnboflines);
|
||||
|
||||
|
||||
if ($picto == 'setup') $picto='title_setup.png';
|
||||
if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif';
|
||||
if ($limit < 0) $limit = $conf->liste_limit;
|
||||
@@ -3104,7 +3107,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
|
||||
$nextpage = 0;
|
||||
}
|
||||
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
|
||||
|
||||
|
||||
print "\n";
|
||||
print "<!-- Begin title '".$titre."' -->\n";
|
||||
print '<table width="100%" border="0" class="notopnoleftnoright'.($morecss?' '.$morecss:'').'" style="margin-bottom: 6px;"><tr>';
|
||||
@@ -3203,7 +3206,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
|
||||
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
|
||||
//$pagesizechoices.=',2:2';
|
||||
if (! empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices=$conf->global->MAIN_PAGESIZE_CHOICES;
|
||||
|
||||
|
||||
print '<li class="pagination">';
|
||||
print '<select class="flat selectlimit" name="limit">';
|
||||
$tmpchoice=explode(',',$pagesizechoices);
|
||||
@@ -3243,7 +3246,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
|
||||
</script>
|
||||
';
|
||||
}
|
||||
print '</li>';
|
||||
print '</li>';
|
||||
}
|
||||
if ($page > 0)
|
||||
{
|
||||
@@ -3282,7 +3285,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
|
||||
function vatrate($rate,$addpercent=false,$info_bits=0,$usestarfornpr=0)
|
||||
{
|
||||
$morelabel='';
|
||||
|
||||
|
||||
if (preg_match('/%/',$rate))
|
||||
{
|
||||
$rate=str_replace('%','',$rate);
|
||||
@@ -3485,7 +3488,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
|
||||
|
||||
/**
|
||||
* Output a dimension with best unit
|
||||
*
|
||||
*
|
||||
* @param float $dimension Dimension
|
||||
* @param int $unit Unit of dimension (0, -3, ...)
|
||||
* @param string $type 'weight', 'volume', ...
|
||||
@@ -3497,16 +3500,16 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
|
||||
function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
|
||||
if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6))
|
||||
|
||||
if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6))
|
||||
{
|
||||
$dimension = $dimension * 1000000;
|
||||
$unit = $unit - 6;
|
||||
$unit = $unit - 6;
|
||||
}
|
||||
elseif (($forceunitoutput == 'no' && $dimension < 1/10) || (is_numeric($forceunitoutput) && $forceunitoutput == -3))
|
||||
{
|
||||
$dimension = $dimension * 1000;
|
||||
$unit = $unit - 3;
|
||||
$unit = $unit - 3;
|
||||
}
|
||||
elseif (($forceunitoutput == 'no' && $dimension > 100000000) || (is_numeric($forceunitoutput) && $forceunitoutput == 6))
|
||||
{
|
||||
@@ -3518,9 +3521,9 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=
|
||||
$dimension = $dimension / 1000;
|
||||
$unit = $unit + 3;
|
||||
}
|
||||
|
||||
|
||||
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
|
||||
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -3551,12 +3554,12 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
|
||||
$vatratecleaned = trim($reg[1]);
|
||||
$vatratecode = $reg[2];
|
||||
}
|
||||
|
||||
|
||||
/*if ($thirdparty_buyer->country_code != $thirdparty_seller->country_code)
|
||||
{
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
|
||||
// Some test to guess with no need to make database access
|
||||
if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe
|
||||
{
|
||||
@@ -3597,7 +3600,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
|
||||
{
|
||||
$conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1;
|
||||
}
|
||||
|
||||
|
||||
// Search local taxes
|
||||
if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY))
|
||||
{
|
||||
@@ -3654,7 +3657,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
|
||||
if ($local==1) return $obj->localtax1;
|
||||
elseif ($local==2) return $obj->localtax2;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3714,7 +3717,7 @@ function get_localtax_by_third($local)
|
||||
|
||||
/**
|
||||
* Get vat rate and npr from id.
|
||||
* You can call getLocalTaxesFromRate after to get other fields
|
||||
* You can call getLocalTaxesFromRate after to get other fields
|
||||
*
|
||||
* @param int $vatrowid Line ID into vat rate table.
|
||||
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
|
||||
@@ -3768,7 +3771,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
$vatratecleaned = $reg[1];
|
||||
$vatratecode = $reg[2];
|
||||
}
|
||||
|
||||
|
||||
// Search local taxes
|
||||
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
||||
@@ -3781,7 +3784,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
$sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
||||
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'";
|
||||
}
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -4188,7 +4191,7 @@ function yn($yesno, $case=1, $color=0)
|
||||
/**
|
||||
* Return a path to have a directory according to object.
|
||||
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
|
||||
* Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
|
||||
* Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
|
||||
*
|
||||
* @param string $num Id of object (deprecated, $object will be used in future)
|
||||
* @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future)
|
||||
@@ -4205,7 +4208,7 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart)
|
||||
$path = '';
|
||||
|
||||
$arrayforoldpath=array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','mailing');
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
|
||||
if (! empty($level) && in_array($modulepart, $arrayforoldpath))
|
||||
{
|
||||
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
|
||||
@@ -4357,7 +4360,7 @@ function dolGetFirstLineOfText($text)
|
||||
{
|
||||
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
|
||||
$firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -5383,11 +5386,11 @@ function printCommonFooter($zone='private')
|
||||
{
|
||||
print '<!-- Reposition management (does not work if a redirect is done after action of submission) -->'."\n";
|
||||
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() {'."\n";
|
||||
|
||||
|
||||
print '<!-- If page_y set, we set scollbar with it -->'."\n";
|
||||
print "page_y=getParameterByName('page_y', 0);";
|
||||
print "if (page_y > 0) $('html, body').scrollTop(page_y);\n";
|
||||
|
||||
|
||||
print '<!-- Set handler to add page_y param on some a href links -->'."\n";
|
||||
print 'jQuery(".reposition").click(function() {
|
||||
var page_y = $(document).scrollTop();
|
||||
@@ -5395,7 +5398,7 @@ function printCommonFooter($zone='private')
|
||||
this.href=this.href+\'&page_y=\'+page_y;
|
||||
});'."\n";
|
||||
print '});'."\n";
|
||||
|
||||
|
||||
if (empty($conf->dol_use_jmobile))
|
||||
{
|
||||
print '<!-- Set handler to switch left menu page -->'."\n";
|
||||
@@ -5404,10 +5407,10 @@ function printCommonFooter($zone='private')
|
||||
if ($conf->theme == 'md') print " $('.login_block').toggle();";
|
||||
print '});'."\n";
|
||||
}
|
||||
|
||||
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
|
||||
// Google Analytics (need Google module)
|
||||
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
|
||||
{
|
||||
@@ -5620,15 +5623,15 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||
$tmpcrit=trim($tmpcrit);
|
||||
$tmpcrit2=$tmpcrit;
|
||||
$tmpbefore='%'; $tmpafter='%';
|
||||
if (preg_match('/^[\^\$]/', $tmpcrit))
|
||||
{
|
||||
if (preg_match('/^[\^\$]/', $tmpcrit))
|
||||
{
|
||||
$tmpbefore='';
|
||||
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
|
||||
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
|
||||
}
|
||||
if (preg_match('/[\^\$]$/', $tmpcrit))
|
||||
{
|
||||
if (preg_match('/[\^\$]$/', $tmpcrit))
|
||||
{
|
||||
$tmpafter='';
|
||||
$tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
|
||||
$tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
|
||||
}
|
||||
$newres .= $tmpbefore;
|
||||
$newres .= $db->escape($tmpcrit2);
|
||||
|
||||
@@ -1158,7 +1158,7 @@ function check_value($mask,$value)
|
||||
|
||||
// If an offset is asked
|
||||
if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]);
|
||||
if (! empty($reg[3]) && preg_match('^\+',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
|
||||
if (! empty($reg[3]) && preg_match('/^\+/',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
|
||||
|
||||
// Define $sqlwhere
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
function project_prepare_head($object)
|
||||
{
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@@ -114,7 +114,7 @@ function project_prepare_head($object)
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'project','remove');
|
||||
|
||||
return $head;
|
||||
@@ -487,7 +487,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
if ($lines[$i]->id) projectLinesa($inc, $lines[$i]->id, $lines, $level, $var, $showproject, $taskrole, $projectsListId, $addordertick);
|
||||
$level--;
|
||||
}
|
||||
|
||||
|
||||
$total_projectlinesa_spent += $lines[$i]->duration;
|
||||
$total_projectlinesa_planned += $lines[$i]->planned_workload;
|
||||
if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration;
|
||||
@@ -551,9 +551,9 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
$lastprojectid=0;
|
||||
$workloadforid=array();
|
||||
$lineswithoutlevel0=array();
|
||||
|
||||
|
||||
$numlines=count($lines);
|
||||
|
||||
|
||||
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
||||
if ($parent == 0) // Always and only if at first level
|
||||
{
|
||||
@@ -561,10 +561,10 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
{
|
||||
if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//dol_syslog('projectLinesPerDay inc='.$inc.' preselectedday='.$preselectedday.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||
|
||||
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
if ($parent == 0) $level = 0;
|
||||
@@ -575,7 +575,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||
{
|
||||
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
||||
|
||||
|
||||
// Break on a new project
|
||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||
{
|
||||
@@ -585,7 +585,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
$projectstatic->id = $lines[$i]->fk_project;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($workloadforid[$projectstatic->id]))
|
||||
{
|
||||
if ($preselectedday)
|
||||
@@ -594,7 +594,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
$workloadforid[$projectstatic->id]=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$projectstatic->id=$lines[$i]->fk_project;
|
||||
$projectstatic->ref=$lines[$i]->projectref;
|
||||
$projectstatic->title=$lines[$i]->projectlabel;
|
||||
@@ -702,16 +702,16 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
|
||||
print '<textarea name="'.$lines[$i]->id.'note" rows="2" id="note">';
|
||||
print '</textarea>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$inc++;
|
||||
$level++;
|
||||
if ($lines[$i]->id > 0)
|
||||
if ($lines[$i]->id > 0)
|
||||
{
|
||||
if ($parent == 0) projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
|
||||
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
|
||||
else projectLinesPerDay($inc, $lines[$i]->id, $fuser, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $preselectedday, $var);
|
||||
}
|
||||
$level--;
|
||||
}
|
||||
@@ -752,7 +752,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$lastprojectid=0;
|
||||
$workloadforid=array();
|
||||
$lineswithoutlevel0=array();
|
||||
|
||||
|
||||
// Create a smaller array with sublevels only to be used later. This increase dramatically performances.
|
||||
if ($parent == 0) // Always and only if at first level
|
||||
{
|
||||
@@ -763,18 +763,18 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
}
|
||||
|
||||
//dol_syslog('projectLinesPerWeek inc='.$inc.' firstdaytoshow='.$firstdaytoshow.' task parent id='.$parent.' level='.$level." count(lines)=".$numlines." count(lineswithoutlevel0)=".count($lineswithoutlevel0));
|
||||
|
||||
|
||||
for ($i = 0 ; $i < $numlines ; $i++)
|
||||
{
|
||||
if ($parent == 0) $level = 0;
|
||||
|
||||
|
||||
if ($lines[$i]->fk_task_parent == $parent)
|
||||
{
|
||||
// If we want all or we have a role on task, we show it
|
||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||
{
|
||||
//dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project);
|
||||
|
||||
|
||||
// Break on a new project
|
||||
if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid)
|
||||
{
|
||||
@@ -782,13 +782,13 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$lastprojectid=$lines[$i]->fk_project;
|
||||
$projectstatic->id = $lines[$i]->fk_project;
|
||||
}
|
||||
|
||||
|
||||
if (empty($workloadforid[$projectstatic->id]))
|
||||
{
|
||||
$projectstatic->loadTimeSpent($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week
|
||||
$workloadforid[$projectstatic->id]=1;
|
||||
}
|
||||
|
||||
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
|
||||
// Project
|
||||
@@ -868,7 +868,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
}
|
||||
|
||||
//var_dump($projectstatic->weekWorkLoadPerTask);
|
||||
|
||||
|
||||
// Fields to show current time
|
||||
$tableCell=''; $modeinput='hours';
|
||||
for ($idw = 0; $idw < 7; $idw++)
|
||||
@@ -879,7 +879,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
$alreadyspent='';
|
||||
if ($dayWorkLoad > 0) $alreadyspent=convertSecondToTime($dayWorkLoad,'allhourmin');
|
||||
$alttitle=$langs->trans("AddHereTimeSpentForDay",$tmparray['day'],$tmparray['mon']);
|
||||
|
||||
|
||||
$tableCell ='<td align="center" class="hide'.$idw.'">';
|
||||
if ($alreadyspent)
|
||||
{
|
||||
@@ -895,7 +895,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
print $tableCell;
|
||||
}
|
||||
dol_syslog("yyy");
|
||||
|
||||
|
||||
print '<td align="right">';
|
||||
if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject"));
|
||||
else if ($disabledtask) print $form->textwithpicto('',$langs->trans("TaskIsNotAffectedToYou"));
|
||||
@@ -907,7 +907,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
|
||||
// Call to show task with a lower level (task under the current task)
|
||||
$inc++;
|
||||
$level++;
|
||||
if ($lines[$i]->id > 0)
|
||||
if ($lines[$i]->id > 0)
|
||||
{
|
||||
if ($parent == 0) projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lineswithoutlevel0, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
|
||||
else projectLinesPerWeek($inc, $firstdaytoshow, $fuser, $lines[$i]->id, $lines, $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $var);
|
||||
@@ -981,7 +981,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
|
||||
$projectstatic=new Project($db);
|
||||
$thirdpartystatic=new Societe($db);
|
||||
|
||||
|
||||
$sortfield='';
|
||||
$sortorder='';
|
||||
$project_year_filter=0;
|
||||
@@ -990,7 +990,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]);
|
||||
|
||||
$arrayidtypeofcontact=array();
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
|
||||
@@ -1033,11 +1033,11 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
$sql.= " AND (p.datee IS NULL OR p.datee >= ".$db->idate(dol_get_first_day($project_year_filter,1,false)).")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get id of project we must show tasks
|
||||
$arrayidofprojects=array();
|
||||
$sql1 = "SELECT p.rowid as projectid";
|
||||
$sql1.= $sql;
|
||||
$sql1.= $sql;
|
||||
$resql = $db->query($sql1);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -1052,7 +1052,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
}
|
||||
else dol_print_error($db);
|
||||
if (empty($arrayidofprojects)) $arrayidofprojects[0]=-1;
|
||||
|
||||
|
||||
// Get list of project with calculation on tasks
|
||||
$sql2 = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_soc, s.nom as socname, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount,";
|
||||
$sql2.= " p.dateo, p.datee,";
|
||||
@@ -1083,7 +1083,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
print_liste_field_titre($langs->trans("OpportunityAmount"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre($langs->trans("PlannedWorkload"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
@@ -1091,7 +1091,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
}
|
||||
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
@@ -1109,7 +1109,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
$projectstatic->title = $objp->title;
|
||||
$projectstatic->datee = $db->jdate($objp->datee);
|
||||
$projectstatic->dateo = $db->jdate($objp->dateo);
|
||||
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>';
|
||||
@@ -1135,17 +1135,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
if ($code) print $langs->trans("OppStatus".$code);
|
||||
print '</td>';
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
print '<td align="right">'.$objp->nb.'</td>';
|
||||
|
||||
|
||||
$plannedworkload=$objp->planned_workload;
|
||||
$total_plannedworkload+=$plannedworkload;
|
||||
if (! in_array('plannedworkload', $hiddenfields))
|
||||
{
|
||||
print '<td align="right">'.($plannedworkload?convertSecondToTime($plannedworkload):'').'</td>';
|
||||
}
|
||||
if (! in_array('declaredprogress', $hiddenfields))
|
||||
if (! in_array('declaredprogress', $hiddenfields))
|
||||
{
|
||||
$declaredprogressworkload=$objp->declared_progess_workload;
|
||||
$total_declaredprogressworkload+=$declaredprogressworkload;
|
||||
@@ -1155,7 +1155,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '<td align="right">'.$projectstatic->getLibStatut(3).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@@ -1174,7 +1174,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
print '<td class="liste_total" align="right">'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).'</td>';
|
||||
print '<td class="liste_total" align="right">'.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).'</td>';
|
||||
}
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
print '<td class="liste_total" align="right">'.$total_task.'</td>';
|
||||
if (! in_array('plannedworkload', $hiddenfields)) print '<td class="liste_total" align="right">'.($total_plannedworkload?convertSecondToTime($total_plannedworkload):'').'</td>';
|
||||
@@ -1182,7 +1182,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
|
||||
}
|
||||
print '<td class="liste_total"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -97,7 +97,7 @@ function tree_showpad(&$fulltree,$key,$silent=0)
|
||||
// ------------------------------- Used by menu editor, category view, ... -----------------
|
||||
|
||||
/**
|
||||
* Recursive function to output menu tree. <ul id="iddivjstree"><li>...</li></ul>
|
||||
* Recursive function to output a tree. <ul id="iddivjstree"><li>...</li></ul>
|
||||
* It is also used for the tree of categories.
|
||||
* Note: To have this function working, check you have loaded the js and css for treeview.
|
||||
* $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
|
||||
@@ -106,7 +106,7 @@ function tree_showpad(&$fulltree,$key,$silent=0)
|
||||
* TODO Replace with jstree plugin instead of treeview plugin.
|
||||
*
|
||||
* @param array $tab Array of all elements
|
||||
* @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>)
|
||||
* @param array $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>)
|
||||
* @param int $rang Level of element
|
||||
* @param string $iddivjstree Id to use for parent ul element
|
||||
* @param int $donoresetalreadyloaded Do not reset global array $donoresetalreadyloaded used to avoid to go down on an aleady processed record
|
||||
@@ -139,7 +139,10 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal
|
||||
print '<ul id="'.$iddivjstree.'">';
|
||||
}
|
||||
|
||||
if ($rang > 50) return; // Protect against infinite loop. Max 50 depth
|
||||
if ($rang > 50)
|
||||
{
|
||||
return; // Protect against infinite loop. Max 50 depth
|
||||
}
|
||||
|
||||
//ballayage du tableau
|
||||
$sizeoftab=count($tab);
|
||||
|
||||
@@ -1071,10 +1071,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
|
||||
if (! empty($conf->categorie->enabled)) {
|
||||
$langs->load("categories");
|
||||
//$newmenu->add("/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer);
|
||||
$newmenu->add("/categories/index.php?type=5",$langs->trans("Rubriques"),0,$user->rights->categorie->creer, '', $mainmenu, 'tags');
|
||||
$newmenu->add("/categories/card.php?action=create&type=5",$langs->trans("NewCategory"),1,$user->rights->categorie->creer);
|
||||
}
|
||||
$newmenu->add("/compta/bank/categ.php",$langs->trans("RubriquesTransactions"),0,$user->rights->categorie->creer, '', $mainmenu, 'tags');
|
||||
$newmenu->add("/compta/bank/categ.php",$langs->trans("NewCategory"),1,$user->rights->categorie->creer, '', $mainmenu, 'tags');
|
||||
}
|
||||
|
||||
// Prelevements
|
||||
if (! empty($conf->prelevement->enabled))
|
||||
|
||||
@@ -48,22 +48,22 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
* @var string Publisher name
|
||||
*/
|
||||
public $editor_name;
|
||||
|
||||
|
||||
/**
|
||||
* @var string URL of module at publisher site
|
||||
*/
|
||||
public $editor_web;
|
||||
|
||||
public $editor_web;
|
||||
|
||||
/**
|
||||
* @var string Family
|
||||
*/
|
||||
public $family;
|
||||
|
||||
|
||||
/**
|
||||
* @var int module_position
|
||||
*/
|
||||
public $module_position=500;
|
||||
|
||||
|
||||
/**
|
||||
* @var string Module name
|
||||
*/
|
||||
@@ -171,7 +171,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
* @var string Module description (long text)
|
||||
*/
|
||||
public $descriptionlong;
|
||||
|
||||
|
||||
/**
|
||||
* @var string[] Module language files
|
||||
*/
|
||||
@@ -211,7 +211,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
* @var bool Module is enabled globally (Multicompany support)
|
||||
*/
|
||||
public $core_enabled;
|
||||
|
||||
|
||||
/**
|
||||
* @var string Relative path to module style sheet
|
||||
* @deprecated
|
||||
@@ -219,8 +219,8 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
*/
|
||||
public $style_sheet = '';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
@@ -468,9 +468,9 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("admin");
|
||||
|
||||
|
||||
if (empty($this->descriptionlong)) return '';
|
||||
|
||||
|
||||
// If module description translation does not exist using its unique id, we can use its name to find translation
|
||||
if (is_array($this->langfiles))
|
||||
{
|
||||
@@ -481,7 +481,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
}
|
||||
return $langs->trans($this->descriptionlong);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gives the publisher name
|
||||
*
|
||||
@@ -491,7 +491,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
{
|
||||
return $this->editor_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gives the publisher url
|
||||
*
|
||||
@@ -501,7 +501,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
{
|
||||
return $this->editor_url;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gives module version (translated if param $translated is on)
|
||||
* For 'experimental' modules, gives 'experimental' translation
|
||||
@@ -705,7 +705,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
$files[] = $file;
|
||||
}
|
||||
sort($files);
|
||||
foreach ($files as $file)
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
|
||||
{
|
||||
@@ -723,7 +723,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
$files[] = $file;
|
||||
}
|
||||
sort($files);
|
||||
foreach ($files as $file)
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if (preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'llx_' && substr($file,0,4) != 'data')
|
||||
{
|
||||
@@ -741,7 +741,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
$files[] = $file;
|
||||
}
|
||||
sort($files);
|
||||
foreach ($files as $file)
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,4) == 'data')
|
||||
{
|
||||
@@ -759,7 +759,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
$files[] = $file;
|
||||
}
|
||||
sort($files);
|
||||
foreach ($files as $file)
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if (preg_match('/\.sql$/i',$file) && ! preg_match('/\.key\.sql$/i',$file) && substr($file,0,6) == 'update')
|
||||
{
|
||||
@@ -899,19 +899,19 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
//$titre = $this->boxes[$key][0];
|
||||
$file = $this->boxes[$key]['file'];
|
||||
//$note = $this->boxes[$key][2];
|
||||
|
||||
|
||||
// TODO If the box is also included by another module and the other module is still on, we should not remove it.
|
||||
// For the moment, we manage this with hard coded exception
|
||||
//print "Remove box ".$file.'<br>';
|
||||
if ($file == 'box_graph_product_distribution.php')
|
||||
{
|
||||
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled))
|
||||
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled))
|
||||
{
|
||||
dol_syslog("We discard disabling of module ".$file." because another module still active require it.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($file)) $file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:''; // For backward compatibility
|
||||
|
||||
if ($this->db->type == 'sqlite3') {
|
||||
@@ -986,7 +986,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
$status = isset($this->cronjobs[$key]['status'])?$this->cronjobs[$key]['status']:'';
|
||||
$priority = isset($this->cronjobs[$key]['priority'])?$this->cronjobs[$key]['priority']:'';
|
||||
$test = isset($this->cronjobs[$key]['test'])?$this->cronjobs[$key]['test']:''; // Line must be visible
|
||||
|
||||
|
||||
// Search if boxes def already present
|
||||
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
|
||||
$sql.= " WHERE module_name = '".$this->db->escape($this->rights_class)."'";
|
||||
@@ -1124,55 +1124,55 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
*
|
||||
* @return int Error count (0 if ok)
|
||||
*/
|
||||
function insert_tabs()
|
||||
{
|
||||
global $conf;
|
||||
function insert_tabs()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$err=0;
|
||||
$err=0;
|
||||
|
||||
if (! empty($this->tabs))
|
||||
{
|
||||
$i=0;
|
||||
foreach ($this->tabs as $key => $value)
|
||||
{
|
||||
if (is_array($value) && count($value) == 0) continue; // Discard empty arrays
|
||||
if (! empty($this->tabs))
|
||||
{
|
||||
$i=0;
|
||||
foreach ($this->tabs as $key => $value)
|
||||
{
|
||||
if (is_array($value) && count($value) == 0) continue; // Discard empty arrays
|
||||
|
||||
$entity=$conf->entity;
|
||||
$newvalue = $value;
|
||||
$entity=$conf->entity;
|
||||
$newvalue = $value;
|
||||
|
||||
if (is_array($value))
|
||||
{
|
||||
$newvalue = $value['data'];
|
||||
if (isset($value['entity'])) $entity = $value['entity'];
|
||||
}
|
||||
if (is_array($value))
|
||||
{
|
||||
$newvalue = $value['data'];
|
||||
if (isset($value['entity'])) $entity = $value['entity'];
|
||||
}
|
||||
|
||||
if ($newvalue)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
|
||||
$sql.= "name";
|
||||
$sql.= ", type";
|
||||
$sql.= ", value";
|
||||
$sql.= ", note";
|
||||
$sql.= ", visible";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1);
|
||||
$sql.= ", 'chaine'";
|
||||
$sql.= ", ".$this->db->encrypt($value,1);
|
||||
$sql.= ", null";
|
||||
$sql.= ", '0'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
if ($newvalue)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
|
||||
$sql.= "name";
|
||||
$sql.= ", type";
|
||||
$sql.= ", value";
|
||||
$sql.= ", note";
|
||||
$sql.= ", visible";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= $this->db->encrypt($this->const_name."_TABS_".$i,1);
|
||||
$sql.= ", 'chaine'";
|
||||
$sql.= ", ".$this->db->encrypt($newvalue,1);
|
||||
$sql.= ", null";
|
||||
$sql.= ", '0'";
|
||||
$sql.= ", ".$entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $err;
|
||||
}
|
||||
dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
|
||||
$this->db->query($sql);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
return $err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds constants
|
||||
|
||||
@@ -483,7 +483,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]= 0;
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
|
||||
// Add line
|
||||
|
||||
@@ -585,7 +585,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0;
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
|
||||
@@ -1120,7 +1120,26 @@ class pdf_crabe extends ModelePDFFactures
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
// VAT
|
||||
// Situations totals migth be wrong on huge amounts
|
||||
if ($object->situation_cycle_ref && $object->situation_counter > 1) {
|
||||
|
||||
$sum_pdf_tva = 0;
|
||||
foreach($this->tva as $tvakey => $tvaval){
|
||||
$sum_pdf_tva+=$tvaval; // sum VAT amounts to compare to object
|
||||
}
|
||||
|
||||
if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one)
|
||||
$coef_fix_tva = $object->total_tva / $sum_pdf_tva;
|
||||
|
||||
foreach($this->tva as $tvakey => $tvaval) {
|
||||
$this->tva[$tvakey]=$tvaval * $coef_fix_tva;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach($this->tva as $tvakey => $tvaval)
|
||||
{
|
||||
if ($tvakey != 0) // On affiche pas taux 0
|
||||
|
||||
@@ -72,7 +72,7 @@ class modCommande extends DolibarrModules
|
||||
$this->depends = array("modSociete");
|
||||
$this->requiredby = array("modExpedition");
|
||||
$this->conflictwith = array();
|
||||
$this->langfiles = array('orders', 'bills', 'companies','products', 'deliveries');
|
||||
$this->langfiles = array('orders', 'bills', 'companies','products', 'deliveries', 'sendings');
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
@@ -178,9 +178,9 @@ class modCommande extends DolibarrModules
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='CustomersOrdersAndOrdersLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_permission[$r]=array(array("commande","commande","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','d.nom'=>'State','co.label'=>'Country','co.code'=>"CountryCode",'s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','c.rowid'=>"Id",'c.ref'=>"Ref",'c.ref_client'=>"RefCustomer",'c.fk_soc'=>"IdCompany",'c.date_creation'=>"DateCreation",'c.date_commande'=>"OrderDate",'c.date_livraison'=>"DateDeliveryPlanned",'c.amount_ht'=>"Amount",'c.remise_percent'=>"GlobalDiscount",'c.total_ht'=>"TotalHT",'c.total_ttc'=>"TotalTTC",'c.facture'=>"Billed",'c.fk_statut'=>'Status','c.note_public'=>"Note",'c.date_livraison'=>'DeliveryDate','c.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','c.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','cd.rowid'=>'LineId','cd.label'=>"Label",'cd.description'=>"LineDescription",'cd.product_type'=>'TypeOfLineServiceOrProduct','cd.tva_tx'=>"LineVATRate",'cd.qty'=>"LineQty",'cd.total_ht'=>"LineTotalHT",'cd.total_tva'=>"LineTotalVAT",'cd.total_ttc'=>"LineTotalTTC",'p.rowid'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label','co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.date_livraison'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company','co.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.siret'=>'company','c.rowid'=>"order",'c.ref'=>"order",'c.ref_client'=>"order",'c.fk_soc'=>"order",'c.date_creation'=>"order",'c.date_commande'=>"order",'c.amount_ht'=>"order",'c.remise_percent'=>"order",'c.total_ht'=>"order",'c.total_ttc'=>"order",'c.facture'=>"order",'c.fk_statut'=>"order",'c.note'=>"order",'c.date_livraison'=>"order",'pj.ref'=>'project','cd.rowid'=>'order_line','cd.label'=>"order_line",'cd.description'=>"order_line",'cd.product_type'=>'order_line','cd.tva_tx'=>"order_line",'cd.qty'=>"order_line",'cd.total_ht'=>"order_line",'cd.total_tva'=>"order_line",'cd.total_ttc'=>"order_line",'p.rowid'=>'product','p.ref'=>'product','p.label'=>'product');
|
||||
$this->export_dependencies_array[$r]=array('order_line'=>'cd.rowid','product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$keyforselect='commande'; $keyforelement='order'; $keyforaliasextra='extra';
|
||||
|
||||
@@ -192,11 +192,11 @@ class modFacture extends DolibarrModules
|
||||
$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bill';
|
||||
$this->export_permission[$r]=array(array("facture","facture","export","other"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
|
||||
//Add 'fd.label'=>"Label" to export_fields_array if you use it. Not used by dolibarr currently.
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text", 'pj.ref'=>'Text', 'fd.label'=>'Text', 'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text", 'pj.ref'=>'Text', 'fd.label'=>'Text', 'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.type'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
|
||||
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
@@ -224,10 +224,10 @@ class modFacture extends DolibarrModules
|
||||
$this->export_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='bill';
|
||||
$this->export_permission[$r]=array(array("facture","facture","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Numeric','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.type'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
|
||||
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
|
||||
@@ -73,7 +73,7 @@ class modFournisseur extends DolibarrModules
|
||||
// Dependencies
|
||||
$this->depends = array("modSociete");
|
||||
$this->requiredby = array();
|
||||
$this->langfiles = array('bills', 'companies', 'suppliers', 'orders');
|
||||
$this->langfiles = array('bills', 'companies', 'suppliers', 'orders', 'sendings');
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array("supplier_order.php");
|
||||
@@ -443,14 +443,14 @@ class modFournisseur extends DolibarrModules
|
||||
$this->export_label[$r]='Commandes fournisseurs et lignes de commandes';
|
||||
$this->export_icon[$r]='order';
|
||||
$this->export_permission[$r]=array(array("fournisseur","commande","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId',
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.date_livraison'=>"DateDeliveryPlanned",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId',
|
||||
'p.ref'=>'ProductRef','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel');
|
||||
if (empty($conf->global->SUPPLIER_ORDER_DOUBLE_APPROVAL))
|
||||
{
|
||||
unset($this->export_fields_array['f.date_approve2']);
|
||||
unset($this->export_fields_array['ua2.login']);
|
||||
}
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label',
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.date_livraison'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label',
|
||||
'p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user','ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product',
|
||||
'p.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project');
|
||||
|
||||
@@ -151,14 +151,14 @@ class modProduct extends DolibarrModules
|
||||
if ($mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
|
||||
if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'BuyingPrice','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin'));
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
|
||||
$this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date');
|
||||
if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
|
||||
if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric'));
|
||||
if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric'));
|
||||
if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
|
||||
if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text'));
|
||||
$this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product");
|
||||
|
||||
@@ -213,18 +213,23 @@ class modProjet extends DolibarrModules
|
||||
$this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid');
|
||||
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
|
||||
's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
||||
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text",
|
||||
's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
||||
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",
|
||||
'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
|
||||
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text");
|
||||
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
|
||||
's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company');
|
||||
's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company');
|
||||
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
|
||||
's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
||||
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description");
|
||||
|
||||
's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
||||
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description");
|
||||
if (empty($conf->global->PROJECT_USE_OPPORTUNITIES))
|
||||
{
|
||||
unset($this->export_fields_array[$r]['p.opp_percent']);
|
||||
unset($this->export_fields_array[$r]['p.opp_amount']);
|
||||
unset($this->export_fields_array[$r]['cls.code']);
|
||||
}
|
||||
|
||||
// Add fields for project
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array());
|
||||
$keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra';
|
||||
|
||||
@@ -252,7 +252,7 @@ class mod_codeproduct_elephant extends ModeleProductCode
|
||||
// Get Mask value
|
||||
$mask = '';
|
||||
if ($type==0) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT)?'':$conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT;
|
||||
if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SSERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE;
|
||||
if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE;
|
||||
if (! $mask)
|
||||
{
|
||||
$this->error='NotConfigured';
|
||||
|
||||
@@ -574,7 +574,7 @@ class pdf_azur extends ModelePDFPropales
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0;
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
|
||||
|
||||
@@ -466,7 +466,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0;
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
|
||||
|
||||
|
||||
@@ -489,7 +489,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne;
|
||||
|
||||
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]='';
|
||||
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0;
|
||||
$this->tva[$vatrate] += $tvaligne;
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage;
|
||||
|
||||
@@ -35,7 +35,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
|
||||
require_once '../main.inc.php';
|
||||
|
||||
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL by the main.inc.php
|
||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
|
||||
$langs->load("main");
|
||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
||||
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
||||
@@ -76,11 +76,11 @@ if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile
|
||||
else
|
||||
{
|
||||
$conf->global->MAIN_HTML5_PLACEHOLDER = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
$usedbyinclude = 1; // Used into next include
|
||||
include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
|
||||
|
||||
|
||||
$accesskeyalreadyassigned=array();
|
||||
foreach($arrayresult as $key => $val)
|
||||
{
|
||||
|
||||
@@ -89,7 +89,7 @@ $(document).ready(function () {
|
||||
|
||||
<div id="login_right">
|
||||
|
||||
<table class="left centpercent" title="Login pass">
|
||||
<table class="left centpercent" title="<?php echo $langs->trans("EnterLoginDetail"); ?>">
|
||||
<!-- Login -->
|
||||
<tr>
|
||||
<td class="nowrap center valignmiddle">
|
||||
|
||||
@@ -37,7 +37,7 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob
|
||||
$usemargins=1;
|
||||
}
|
||||
|
||||
global $dateSelector, $forceall, $senderissupplier, $inputalsopricewithtax;
|
||||
global $forceall, $senderissupplier, $inputalsopricewithtax;
|
||||
if (empty($dateSelector)) $dateSelector=0;
|
||||
if (empty($forceall)) $forceall=0;
|
||||
if (empty($senderissupplier)) $senderissupplier=0;
|
||||
|
||||
@@ -69,19 +69,20 @@ if (empty($usemargins)) $usemargins=0;
|
||||
<?php
|
||||
if ($line->description)
|
||||
{
|
||||
if ($line->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0)
|
||||
if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
|
||||
}
|
||||
elseif ($line->description == '(DEPOSIT)' && $objp->fk_remise_except > 0)
|
||||
elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
|
||||
// Add date of deposit
|
||||
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')';
|
||||
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE))
|
||||
echo ' ('.dol_print_date($discount->datec).')';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -108,7 +108,7 @@ class Cronjob extends CommonObject
|
||||
if (isset($this->nbrun)) $this->nbrun=trim($this->nbrun);
|
||||
if (isset($this->libname)) $this->libname = trim($this->libname);
|
||||
if (isset($this->test)) $this->test = trim($this->test);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
if (dol_strlen($this->datestart)==0) {
|
||||
@@ -363,9 +363,9 @@ class Cronjob extends CommonObject
|
||||
function fetch_all($sortorder='DESC', $sortfield='t.rowid', $limit=0, $offset=0, $status=1, $filter='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
$this->lines=array();
|
||||
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.entity,";
|
||||
@@ -403,7 +403,7 @@ class Cronjob extends CommonObject
|
||||
if ($status == 2) $sql.= " AND t.status = 2";
|
||||
//Manage filter
|
||||
if (is_array($filter) && count($filter)>0) {
|
||||
foreach($filter as $key => $value)
|
||||
foreach($filter as $key => $value)
|
||||
{
|
||||
if ($key == 't.rowid') $sql.= ' AND '.$key.' = '.$this->db->escape($value);
|
||||
else $sql.= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
@@ -526,7 +526,7 @@ class Cronjob extends CommonObject
|
||||
if (empty($this->maxrun)) $this->maxrun=0;
|
||||
if (isset($this->libname)) $this->libname = trim($this->libname);
|
||||
if (isset($this->test)) $this->test = trim($this->test);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
if (dol_strlen($this->datestart)==0) {
|
||||
@@ -837,8 +837,8 @@ class Cronjob extends CommonObject
|
||||
|
||||
/**
|
||||
* Run a job.
|
||||
* Once job is finished, status and nb of run is updated.
|
||||
* This function does not plan the next run. This is done by function ->reprogram_jobs
|
||||
* Once job is finished, status and nb of run is updated.
|
||||
* This function does not plan the next run. This is done by function ->reprogram_jobs
|
||||
*
|
||||
* @param string $userlogin User login
|
||||
* @return int <0 if KO, >0 if OK
|
||||
@@ -853,7 +853,7 @@ class Cronjob extends CommonObject
|
||||
|
||||
$langs->load('cron');
|
||||
|
||||
if (empty($userlogin))
|
||||
if (empty($userlogin))
|
||||
{
|
||||
$this->error="User login is mandatory";
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
@@ -914,16 +914,16 @@ class Cronjob extends CommonObject
|
||||
// load classes
|
||||
if (! $error)
|
||||
{
|
||||
$ret=dol_include_once($this->classesname);
|
||||
if ($ret===false || (! class_exists($this->objectname)))
|
||||
{
|
||||
$this->error=$langs->trans('CronCannotLoadClass',$this->classesname,$this->objectname);
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$this->lastoutput = $this->error;
|
||||
$this->lastresult = -1;
|
||||
$retval = $this->lastresult;
|
||||
$error++;
|
||||
}
|
||||
$ret=dol_include_once($this->classesname);
|
||||
if ($ret===false || (! class_exists($this->objectname)))
|
||||
{
|
||||
$this->error=$langs->trans('CronCannotLoadClass',$this->classesname,$this->objectname);
|
||||
dol_syslog(get_class($this)."::run_jobs ".$this->error, LOG_ERR);
|
||||
$this->lastoutput = $this->error;
|
||||
$this->lastresult = -1;
|
||||
$retval = $this->lastresult;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
// test if method exists
|
||||
@@ -939,7 +939,7 @@ class Cronjob extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Load langs
|
||||
if (! $error)
|
||||
{
|
||||
@@ -954,14 +954,14 @@ class Cronjob extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
dol_syslog(get_class($this)."::run_jobs START ".$this->objectname."->".$this->methodename."(".$this->params.");", LOG_DEBUG);
|
||||
|
||||
|
||||
// Create Object for the call module
|
||||
$object = new $this->objectname($this->db);
|
||||
|
||||
|
||||
$params_arr = explode(", ",$this->params);
|
||||
if (!is_array($params_arr))
|
||||
{
|
||||
@@ -971,8 +971,8 @@ class Cronjob extends CommonObject
|
||||
{
|
||||
$result = call_user_func_array(array($object, $this->methodename), $params_arr);
|
||||
}
|
||||
|
||||
if ($result===false || $result != 0)
|
||||
|
||||
if ($result === false || (! is_bool($result) && $result != 0))
|
||||
{
|
||||
$langs->load("errors");
|
||||
dol_syslog(get_class($this)."::run_jobs END result=".$result." error=".$object->error, LOG_ERR);
|
||||
@@ -989,7 +989,7 @@ class Cronjob extends CommonObject
|
||||
$this->lastresult=var_export($result,true);
|
||||
$retval = $this->lastresult;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($this->jobtype == 'function')
|
||||
@@ -1021,7 +1021,7 @@ class Cronjob extends CommonObject
|
||||
$result = call_user_func_array($this->methodename, $params_arr);
|
||||
}
|
||||
|
||||
if ($result === false || $result != 0)
|
||||
if ($result === false || (! is_bool($result) && $result != 0))
|
||||
{
|
||||
$langs->load("errors");
|
||||
dol_syslog(get_class($this)."::run_jobs result=".$result, LOG_ERR);
|
||||
@@ -1062,7 +1062,7 @@ class Cronjob extends CommonObject
|
||||
$this->lastoutput = ''; // Will be filled later
|
||||
$this->lastresult = $retval;
|
||||
$retval = $this->lastresult;
|
||||
$error++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if ($execmethod == 2)
|
||||
@@ -1086,21 +1086,21 @@ class Cronjob extends CommonObject
|
||||
}
|
||||
|
||||
// Update with result
|
||||
if (is_array($output_arr) && count($output_arr)>0)
|
||||
{
|
||||
foreach($output_arr as $val)
|
||||
{
|
||||
$this->lastoutput.=$val."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$this->lastresult=$retval;
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
|
||||
if (is_array($output_arr) && count($output_arr)>0)
|
||||
{
|
||||
foreach($output_arr as $val)
|
||||
{
|
||||
$this->lastoutput.=$val."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$this->lastresult=$retval;
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs output_arr:".var_export($output_arr,true)." lastoutput=".$this->lastoutput." lastresult=".$this->lastresult, LOG_DEBUG);
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::run_jobs now we update job to track it is finished (with success or error)");
|
||||
|
||||
|
||||
$this->datelastresult=dol_now();
|
||||
$result = $this->update($user); // This include begin/commit
|
||||
if ($result < 0)
|
||||
@@ -1125,19 +1125,19 @@ class Cronjob extends CommonObject
|
||||
function reprogram_jobs($userlogin, $now)
|
||||
{
|
||||
dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG);
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$user=new User($this->db);
|
||||
$result=$user->fetch('',$userlogin);
|
||||
if ($result<0)
|
||||
if ($result<0)
|
||||
{
|
||||
$this->error="User Error:".$user->error;
|
||||
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (empty($user->id))
|
||||
if (empty($user->id))
|
||||
{
|
||||
$this->error=" User user login:".$userlogin." do not exists";
|
||||
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
|
||||
@@ -1147,24 +1147,24 @@ class Cronjob extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::reprogram_jobs ", LOG_DEBUG);
|
||||
|
||||
|
||||
if (empty($this->datenextrun))
|
||||
|
||||
if (empty($this->datenextrun))
|
||||
{
|
||||
if (empty($this->datestart)) $this->datenextrun = $now + ($this->frequency * $this->unitfrequency);
|
||||
else $this->datenextrun = $this->datestart + ($this->frequency * $this->unitfrequency);
|
||||
}
|
||||
|
||||
if ($this->datenextrun < $now && $this->frequency > 0 && $this->unitfrequency > 0)
|
||||
if ($this->datenextrun < $now && $this->frequency > 0 && $this->unitfrequency > 0)
|
||||
{
|
||||
// Loop until date is after future
|
||||
while ($this->datenextrun < $now)
|
||||
{
|
||||
$this->datenextrun += ($this->frequency * $this->unitfrequency);
|
||||
|
||||
|
||||
// TODO For exact frequency (every month, every year, ...), use instead a dol_time_plus_duree($time, $duration_value, $duration_unit)
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
//$this->datenextrun=$this->datenextrun + ($this->frequency * $this->unitfrequency);
|
||||
}
|
||||
@@ -1180,9 +1180,9 @@ class Cronjob extends CommonObject
|
||||
dol_syslog(get_class($this)."::reprogram_jobs Job will be set to archived", LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result = $this->update($user);
|
||||
if ($result<0)
|
||||
if ($result<0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
|
||||
@@ -524,13 +524,14 @@ class PaymentExpenseReport extends CommonObject
|
||||
{
|
||||
if ($mode == 'payment_expensereport')
|
||||
{
|
||||
$euser = new User($this->db);
|
||||
$euser->fetch($key);
|
||||
$er = new ExpenseReport($this->db);
|
||||
$er->fetch($key);
|
||||
$er->fetch_user($er->fk_user_author);
|
||||
$result=$acc->add_url_line(
|
||||
$bank_line_id,
|
||||
$euser->id,
|
||||
$er->user->id,
|
||||
DOL_URL_ROOT.'/user/card.php?id=',
|
||||
$euser->getFullName($langs),
|
||||
$er->user->getFullName($langs),
|
||||
'user'
|
||||
);
|
||||
if ($result <= 0)
|
||||
|
||||
@@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("bills");
|
||||
$langs->load("banks");
|
||||
|
||||
$chid=GETPOST("id");
|
||||
$action=GETPOST('action');
|
||||
@@ -62,22 +63,22 @@ if ($action == 'add_payment')
|
||||
|
||||
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
|
||||
if (! $_POST["fk_typepayment"] > 0)
|
||||
if (! ($_POST["fk_typepayment"] > 0))
|
||||
{
|
||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($datepaid == '')
|
||||
{
|
||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date"));
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! empty($conf->banque->enabled) && ! $accountid > 0)
|
||||
if (! empty($conf->banque->enabled) && ! ($accountid > 0))
|
||||
{
|
||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit"));
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToDebit")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$paymentid = 0;
|
||||
@@ -163,7 +164,6 @@ $form=new Form($db);
|
||||
// Form to create expense report payment
|
||||
if (GETPOST("action") == 'create')
|
||||
{
|
||||
|
||||
$expensereport = new ExpenseReport($db);
|
||||
$expensereport->fetch($chid);
|
||||
|
||||
@@ -171,11 +171,6 @@ if (GETPOST("action") == 'create')
|
||||
|
||||
print load_fiche_titre($langs->trans("DoPayment"));
|
||||
|
||||
if ($mesg)
|
||||
{
|
||||
print "<div class=\"error\">$mesg</div>";
|
||||
}
|
||||
|
||||
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$chid.'">';
|
||||
@@ -222,12 +217,15 @@ if (GETPOST("action") == 'create')
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired">'.$langs->trans('AccountToDebit').'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes(isset($_POST["accountid"])?$_POST["accountid"]:$expensereport->accountid, "accountid", 0, '',1); // Show open bank account list
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Number
|
||||
print '<tr><td>'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
@@ -243,9 +241,7 @@ if (GETPOST("action") == 'create')
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
* Autres charges impayees
|
||||
*/
|
||||
// List of expenses ereport not already paid completely
|
||||
$num = 1;
|
||||
$i = 0;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ $mainmenu=GETPOST('mainmenu', 'alpha');
|
||||
$leftmenu=GETPOST('leftmenu', 'alpha');
|
||||
$idmenu=GETPOST('idmenu', 'int');
|
||||
$theme=GETPOST('theme', 'alpha');
|
||||
$codelang=GETPOST('lang', 'alpha');
|
||||
$codelang=GETPOST('lang', 'aZ09');
|
||||
|
||||
print "
|
||||
<html>
|
||||
|
||||
@@ -583,7 +583,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Classify Billed
|
||||
// Classify unbilled
|
||||
else if ($action == 'classifyunbilled' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$result=$object->setStatut(1);
|
||||
@@ -598,6 +598,21 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Classify Done
|
||||
else if ($action == 'classifydone' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$result=$object->setStatut(3);
|
||||
if ($result > 0)
|
||||
{
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Mise a jour d'une ligne d'intervention
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.4');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.7');
|
||||
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ $hookmanager->initHooks(array('suppliercard','globalcard'));
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
@@ -1143,6 +1143,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
$this->lines[$i]->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$this->lines[$i]->product_type,
|
||||
$this->lines[$i]->info_bits
|
||||
);
|
||||
if ($result < 0)
|
||||
@@ -1373,7 +1374,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
if ($result > 0)
|
||||
{
|
||||
$pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice
|
||||
$ref = $prod->ref_fourn; // Ref supplier price set by get_buyprice
|
||||
$fourn_ref = $prod->ref_fourn; // Ref supplier price set by get_buyprice
|
||||
}
|
||||
if ($result == 0) // If result == 0, we failed to found the supplier reference price
|
||||
{
|
||||
@@ -1437,11 +1438,14 @@ class CommandeFournisseur extends CommonOrder
|
||||
$localtax2_type=$localtaxes_type[2];
|
||||
|
||||
$subprice = price2num($pu,'MU');
|
||||
|
||||
$rangmax = $this->line_max();
|
||||
$rang = $rangmax + 1;
|
||||
|
||||
// TODO We should use here $this->line=new CommandeFournisseurLigne($this->db); and $this->line->insert(); to work like other object (proposal, order, invoice)
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
|
||||
$sql.= " (fk_commande, label, description, date_start, date_end,";
|
||||
$sql.= " fk_product, product_type,";
|
||||
$sql.= " fk_product, product_type, rang,";
|
||||
$sql.= " qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice, ref,";
|
||||
$sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,";
|
||||
$sql.= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc";
|
||||
@@ -1451,13 +1455,13 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql.= " ".($date_end?"'".$this->db->idate($date_end)."'":"null").",";
|
||||
if ($fk_product) { $sql.= $fk_product.","; }
|
||||
else { $sql.= "null,"; }
|
||||
$sql.= "'".$product_type."',";
|
||||
$sql.= "'".$product_type."', ".$rang.",";
|
||||
$sql.= "'".$qty."', ".$txtva.", ".$txlocaltax1.", ".$txlocaltax2;
|
||||
|
||||
$sql.= ", '".$localtax1_type."',";
|
||||
$sql.= " '".$localtax2_type."'";
|
||||
|
||||
$sql.= ", ".$remise_percent.",'".price2num($subprice,'MU')."','".$ref."',";
|
||||
$sql.= ", ".$remise_percent.",'".price2num($subprice,'MU')."','".$this->db->escape($fourn_ref)."',";
|
||||
$sql.= "'".price2num($total_ht)."',";
|
||||
$sql.= "'".price2num($total_tva)."',";
|
||||
$sql.= "'".price2num($total_localtax1)."',";
|
||||
@@ -2752,7 +2756,8 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
$sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,';
|
||||
$sql.= ' cd.total_localtax1, cd.total_localtax2,';
|
||||
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,';
|
||||
$sql.= ' cd.date_start, cd.date_end, cd.fk_unit';
|
||||
$sql.= ' cd.date_start, cd.date_end, cd.fk_unit,';
|
||||
$sql.= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||
$sql.= ' WHERE cd.rowid = '.$rowid;
|
||||
@@ -2760,33 +2765,38 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
if ($result)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$this->rowid = $objp->rowid;
|
||||
$this->fk_commande = $objp->fk_commande;
|
||||
$this->desc = $objp->description;
|
||||
$this->qty = $objp->qty;
|
||||
$this->subprice = $objp->subprice;
|
||||
$this->tva_tx = $objp->tva_tx;
|
||||
$this->localtax1_tx = $objp->localtax1_tx;
|
||||
$this->localtax2_tx = $objp->localtax2_tx;
|
||||
$this->remise = $objp->remise;
|
||||
$this->remise_percent = $objp->remise_percent;
|
||||
$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_localtax1 = $objp->total_localtax1;
|
||||
$this->total_localtax2 = $objp->total_localtax2;
|
||||
$this->total_ttc = $objp->total_ttc;
|
||||
$this->product_type = $objp->product_type;
|
||||
$this->rowid = $objp->rowid;
|
||||
$this->fk_commande = $objp->fk_commande;
|
||||
$this->desc = $objp->description;
|
||||
$this->qty = $objp->qty;
|
||||
$this->subprice = $objp->subprice;
|
||||
$this->tva_tx = $objp->tva_tx;
|
||||
$this->localtax1_tx = $objp->localtax1_tx;
|
||||
$this->localtax2_tx = $objp->localtax2_tx;
|
||||
$this->remise = $objp->remise;
|
||||
$this->remise_percent = $objp->remise_percent;
|
||||
$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_localtax1 = $objp->total_localtax1;
|
||||
$this->total_localtax2 = $objp->total_localtax2;
|
||||
$this->total_ttc = $objp->total_ttc;
|
||||
$this->product_type = $objp->product_type;
|
||||
|
||||
$this->ref = $objp->product_ref;
|
||||
$this->product_libelle = $objp->product_libelle;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
$this->ref = $objp->product_ref;
|
||||
$this->product_libelle = $objp->product_libelle;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
|
||||
$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);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1507,7 +1507,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("SupplierBillsToPay");
|
||||
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills';
|
||||
$response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=f.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills';
|
||||
$response->img=img_object($langs->trans("Bills"),"bill");
|
||||
|
||||
$facturestatic = new FactureFournisseur($this->db);
|
||||
@@ -1627,6 +1627,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$obj->error;
|
||||
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
|
||||
return false;
|
||||
}
|
||||
@@ -2075,8 +2076,9 @@ class SupplierInvoiceLine extends CommonObjectLine
|
||||
{
|
||||
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx';
|
||||
$sql.= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
|
||||
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
|
||||
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit';
|
||||
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
|
||||
$sql.= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
|
||||
$sql.= ' WHERE f.rowid = '.$rowid;
|
||||
@@ -2097,6 +2099,7 @@ class SupplierInvoiceLine extends CommonObjectLine
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
$this->fk_facture_fourn = $obj->fk_facture_fourn;
|
||||
$this->description = $obj->description;
|
||||
$this->product_ref = $obj->product_ref;
|
||||
$this->ref = $obj->product_ref;
|
||||
@@ -2129,6 +2132,11 @@ class SupplierInvoiceLine extends CommonObjectLine
|
||||
$this->rang = $obj->rang;
|
||||
$this->fk_unit = $obj->fk_unit;
|
||||
|
||||
$this->multicurrency_subprice = $obj->multicurrency_subprice;
|
||||
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
|
||||
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -581,7 +581,8 @@ class ProductFournisseur extends Product
|
||||
foreach($record_array as $record)
|
||||
{
|
||||
$fourn_price = $record["price"];
|
||||
$fourn_unitprice = $record["unitprice"];
|
||||
// discount calculated buy price
|
||||
$fourn_unitprice = $record["unitprice"] * (1 - $record["remise_percent"] / 100) + $record["unitcharges"] - $record["remise"];
|
||||
if (!empty($conf->dynamicprices->enabled) && !empty($record["fk_supplier_price_expression"])) {
|
||||
$prod_supplier = new ProductFournisseur($this->db);
|
||||
$prod_supplier->product_fourn_price_id = $record["product_fourn_price_id"];
|
||||
@@ -613,7 +614,7 @@ class ProductFournisseur extends Product
|
||||
$this->fourn_qty = $record["quantity"];
|
||||
$this->fourn_remise_percent = $record["remise_percent"];
|
||||
$this->fourn_remise = $record["remise"];
|
||||
$this->fourn_unitprice = $fourn_unitprice;
|
||||
$this->fourn_unitprice = $record["unitprice"];
|
||||
$this->fourn_charges = $record["charges"]; // deprecated
|
||||
$this->fourn_unitcharges = $record["unitcharges"]; // deprecated
|
||||
$this->fourn_tva_tx = $record["tva_tx"];
|
||||
@@ -622,7 +623,7 @@ class ProductFournisseur extends Product
|
||||
$this->delivery_time_days = $record["delivery_time_days"];
|
||||
$this->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
|
||||
$this->id = $prodid;
|
||||
$min = $this->fourn_unitprice;
|
||||
$min = $fourn_unitprice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2585,19 +2585,29 @@ elseif (! empty($object->id))
|
||||
// Create bill
|
||||
if (! empty($conf->facture->enabled))
|
||||
{
|
||||
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->billed != 1)) // 2 means accepted
|
||||
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->billed != 1)) // statut 2 means approved
|
||||
{
|
||||
if ($user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
|
||||
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && !empty($object->linkedObjectsIds['invoice_supplier']))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not)
|
||||
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && $object->billed != 1) // statut 2 means approved
|
||||
{
|
||||
if (empty($conf->facture->enabled))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
else if (!empty($object->linkedObjectsIds['invoice_supplier']))
|
||||
{
|
||||
if ($user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create a remote order using WebService only if module is activated
|
||||
|
||||
@@ -314,7 +314,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
if ($commande->methode_commande)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->methode_commande.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Method").'</td><td colspan="2">'.$commande->getInputMethod().'</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ $search_total_vat=GETPOST('search_total_vat','alpha');
|
||||
$search_total_ttc=GETPOST('search_total_ttc','alpha');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
$billed = GETPOST('billed','int');
|
||||
$search_project_ref=GETPOST('search_project_ref','alpha');
|
||||
|
||||
$page = GETPOST('page','int');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
@@ -204,6 +205,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$deliverymonth='';
|
||||
$deliveryyear='';
|
||||
$billed='';
|
||||
$search_project_ref='';
|
||||
$search_array_options=array();
|
||||
|
||||
}
|
||||
@@ -350,6 +352,7 @@ if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.elemen
|
||||
if ($search_total_ht != '') $sql.= natural_search('cf.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_vat != '') $sql.= natural_search('cf.tva', $search_total_vat, 1);
|
||||
if ($search_total_ttc != '') $sql.= natural_search('cf.total_ttc', $search_total_ttc, 1);
|
||||
if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref);
|
||||
|
||||
// Add where from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
|
||||
@@ -456,7 +456,13 @@ if (empty($reshook))
|
||||
$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;
|
||||
|
||||
// Extrafields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$targetExtraFields = new ExtraFields($db);
|
||||
$targetExtraFieldLabels = $targetExtraFields->fetch_name_optionals_label($object->table_element_line);
|
||||
$lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraFieldLabels);
|
||||
}
|
||||
// FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example.
|
||||
$result = $object->addline(
|
||||
$desc,
|
||||
@@ -870,7 +876,7 @@ if (empty($reshook))
|
||||
$action = '';
|
||||
}
|
||||
|
||||
elseif ($action == 'classin')
|
||||
elseif ($action == 'classin' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setProject($projectid);
|
||||
@@ -1844,7 +1850,9 @@ else
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('PaymentConditions');
|
||||
print '<td>';
|
||||
if ($action != 'editconditions') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
if ($action != 'editconditions' && $user->rights->fournisseur->facture->creer) {
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
if ($action == 'editconditions')
|
||||
@@ -1864,7 +1872,9 @@ else
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
if ($action != 'editmode' && $user->rights->fournisseur->facture->creer) {
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="2">';
|
||||
if ($action == 'editmode')
|
||||
@@ -1994,7 +2004,7 @@ else
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Project');
|
||||
print '</td>';
|
||||
if ($action != 'classify')
|
||||
if ($action != 'classify' && $user->rights->fournisseur->facture->creer)
|
||||
{
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classify&id='.$object->id.'">';
|
||||
print img_edit($langs->trans('SetProject'),1);
|
||||
@@ -2135,13 +2145,17 @@ else
|
||||
// Reopen a standard paid invoice
|
||||
if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_REPLACEMENT) && ($object->statut == 2 || $object->statut == 3)) // A paid invoice (partially or completely)
|
||||
{
|
||||
if (! $facidnext && $object->close_code != 'replaced') // Not replaced by another invoice
|
||||
if (! $facidnext && $object->close_code != 'replaced' && $user->rights->fournisseur->facture->creer) // Not replaced by another invoice
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans('ReOpen').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
|
||||
if ($user->rights->fournisseur->facture->creer) {
|
||||
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
|
||||
} elseif (!$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) {
|
||||
print '<span class="butActionRefused">'.$langs->trans('ReOpen').'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015-2007 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Abbes Bahfir <bafbes@gmail.com>
|
||||
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
@@ -46,6 +46,7 @@ if (!$user->rights->fournisseur->facture->lire) accessforbidden();
|
||||
$langs->load("bills");
|
||||
$langs->load("companies");
|
||||
$langs->load('products');
|
||||
$langs->load('projects');
|
||||
|
||||
$socid = GETPOST('socid','int');
|
||||
|
||||
@@ -83,9 +84,12 @@ $day_lim = GETPOST('day_lim','int');
|
||||
$month_lim = GETPOST('month_lim','int');
|
||||
$year_lim = GETPOST('year_lim','int');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$filter = GETPOST('filtre','alpha');
|
||||
|
||||
$option = GETPOST('option');
|
||||
if ($option == 'late') $filter = 'paye:0';
|
||||
if ($option == 'late') {
|
||||
$filter = 'paye:0';
|
||||
}
|
||||
|
||||
$search_all = GETPOST('sall');
|
||||
$search_label = GETPOST("search_label","alpha");
|
||||
@@ -434,6 +438,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
|
||||
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit);
|
||||
|
||||
@@ -788,7 +793,7 @@ if ($resql)
|
||||
$thirdparty->name=$obj->name;
|
||||
$thirdparty->client=$obj->client;
|
||||
$thirdparty->code_client=$obj->code_client;
|
||||
print $thirdparty->getNomUrl(1,'customer');
|
||||
print $thirdparty->getNomUrl(1,'supplier');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@@ -565,19 +565,16 @@ if (empty($action))
|
||||
if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,';
|
||||
$sql.= ' SUM(f.amount)';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
|
||||
if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
||||
if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= ' AND f.fk_soc = '.$socid;
|
||||
}
|
||||
if ($socid > 0) $sql .= ' AND f.fk_soc = '.$socid;
|
||||
// Search criteria
|
||||
if ($search_ref) $sql .= natural_search('p.rowid', $search_ref);
|
||||
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2012-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014-2017 Ferran Marcet <fmarcet@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
|
||||
@@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
$myparam = GETPOST("myparam");
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$id=GETPOST('id', 'int');
|
||||
$userid = GETPOST('userid')?GETPOST('userid'):$user->id;
|
||||
$fuserid = (GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id);
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
@@ -57,7 +57,8 @@ if ($action == 'create')
|
||||
$cp = new Holiday($db);
|
||||
|
||||
// If no right to create a request
|
||||
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
|
||||
$fuserid = GETPOST('fuserid');
|
||||
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('CantCreateCP'), null, 'errors');
|
||||
@@ -82,7 +83,6 @@ if ($action == 'create')
|
||||
|
||||
$valideur = GETPOST('valideur');
|
||||
$description = trim(GETPOST('description'));
|
||||
$userID = GETPOST('userID');
|
||||
|
||||
// If no type
|
||||
if ($type <= 0)
|
||||
@@ -115,7 +115,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Check if there is already holiday for this period
|
||||
$verifCP = $cp->verifDateHolidayCP($userID, $date_debut, $date_fin, $halfday);
|
||||
$verifCP = $cp->verifDateHolidayCP($fuserid, $date_debut, $date_fin, $halfday);
|
||||
if (! $verifCP)
|
||||
{
|
||||
setEventMessages($langs->trans("alreadyCPexist"), null, 'errors');
|
||||
@@ -145,7 +145,7 @@ if ($action == 'create')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$cp->fk_user = $userid;
|
||||
$cp->fk_user = $fuserid;
|
||||
$cp->description = $description;
|
||||
$cp->date_debut = $date_debut;
|
||||
$cp->date_fin = $date_fin;
|
||||
@@ -689,7 +689,7 @@ llxHeader('', $langs->trans('CPTitreMenu'));
|
||||
if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create')
|
||||
{
|
||||
// Si l'utilisateur n'a pas le droit de faire une demande
|
||||
if (($userid == $user->id && empty($user->rights->holiday->write)) || ($userid != $user->id && empty($user->rights->holiday->write_all)))
|
||||
if (($fuserid == $user->id && empty($user->rights->holiday->write)) || ($fuserid != $user->id && empty($user->rights->holiday->write_all)))
|
||||
{
|
||||
$errors[]=$langs->trans('CantCreateCP');
|
||||
}
|
||||
@@ -769,7 +769,6 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
|
||||
// Formulaire de demande
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" onsubmit="return valider()" name="demandeCP">'."\n";
|
||||
print '<input type="hidden" name="action" value="create" />'."\n";
|
||||
print '<input type="hidden" name="userID" value="'.$userid.'" />'."\n";
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
@@ -800,10 +799,10 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
|
||||
print '<td>';
|
||||
if (empty($user->rights->holiday->write_all))
|
||||
{
|
||||
print $form->select_dolusers($userid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '<input type="hidden" name="userid" value="'.$userid.'">';
|
||||
print $form->select_dolusers($fuserid, 'useridbis', 0, '', 1, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
|
||||
}
|
||||
else print $form->select_dolusers(GETPOST('userid')?GETPOST('userid'):$user->id,'userid',0,'',0);
|
||||
else print $form->select_dolusers(GETPOST('fuserid')?GETPOST('fuserid'):$user->id,'fuserid',0,'',0);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@@ -383,7 +383,7 @@ if ($showweather) $boxwork.='<th class="liste_titre hideonsmartphone" width="80"
|
||||
$boxwork.='</tr>'."\n";
|
||||
|
||||
// Do not include sections without management permission
|
||||
require DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
||||
|
||||
// Number of actions to do (late)
|
||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read)
|
||||
|
||||
@@ -258,7 +258,7 @@ if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP 5.
|
||||
|
||||
// Defini objet langs
|
||||
$langs = new Translate('..',$conf);
|
||||
if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang'));
|
||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09'));
|
||||
else $langs->setDefaultLang('auto');
|
||||
|
||||
$bc[false]=' class="bg1"';
|
||||
@@ -442,9 +442,9 @@ function pFooter($nonext=0,$setuplang='',$jscheckfunction='', $withpleasewait=0)
|
||||
print '<div class="nextbutton" id="nextbutton">';
|
||||
if ($nonext == '2')
|
||||
{
|
||||
print $langs->trans("ErrorFoundDuringMigration", $_SERVER["REQUEST_URI"].'&ignoreerrors=1').'<br><br>';
|
||||
print $langs->trans("ErrorFoundDuringMigration", $_SERVER["REQUEST_URI"].'&ignoreerrors=1').'<br><br>';
|
||||
}
|
||||
|
||||
|
||||
print '<input type="submit" '.($nonext == '2' ? 'disabled="disabled" ':'').'value="'.$langs->trans("NextStep").' ->"';
|
||||
if ($jscheckfunction) print ' onClick="return '.$jscheckfunction.'();"';
|
||||
print '></div>';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user