forked from Wavyzz/dolibarr
Compare commits
255 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
983efdd6ee | ||
|
|
2aae4ea6ea | ||
|
|
157b17b6d5 | ||
|
|
ecab8d874b | ||
|
|
c953ae2a3d | ||
|
|
98599b0bbf | ||
|
|
635157be4c | ||
|
|
e297b64722 | ||
|
|
cdcbf58ca8 | ||
|
|
9cc2a74221 | ||
|
|
f7e5898b4a | ||
|
|
94eeaf9ed0 | ||
|
|
8b275c6e5c | ||
|
|
bd002656cd | ||
|
|
f68d956eaa | ||
|
|
e020a859f0 |
186
ChangeLog
186
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
|
||||
@@ -267,6 +344,115 @@ So if you included it into your module, change your code like this to be compati
|
||||
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.4 compared to 3.9.3 *****
|
||||
FIX: #2853
|
||||
FIX: #3128
|
||||
FIX: #4447
|
||||
FIX: #5128 if create method return duplicated code error not use GETPOST in order to get a new code
|
||||
FIX: #5340
|
||||
FIX: #5473
|
||||
FIX: #5474 Country_id of "Don" object is still empty
|
||||
FIX: #5534
|
||||
FIX: #5535 bad dependency.
|
||||
FIX: #5537 AJAX project search does not work properly
|
||||
FIX: #5540 getFormMail is not registered as addReplace hook
|
||||
FIX: #5544 Disabled Contact still appear in lists to send emails
|
||||
FIX: #5549 getNomUrl tooltips show Order info even if user has no rights to read them
|
||||
FIX: #5568
|
||||
FIX: #5594
|
||||
FIX: #5629 PgSQL Interger string stylish error
|
||||
FIX: #5651
|
||||
FIX: #5660
|
||||
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
|
||||
FIX: #5907
|
||||
FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them
|
||||
FIX: #6051
|
||||
FIX: #6088
|
||||
FIX: Can correct stock of lot using eatby or sell by date
|
||||
FIX: Can make a movement on "out of sell" products
|
||||
FIX: cannot update bank account on invoice if module order not activated
|
||||
FIX: Can't create withdrawal document
|
||||
FIX: delete contract extrafields on contract deletion
|
||||
FIX: Direction of movement lost if an error occurs
|
||||
FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
|
||||
FIX: export extrafields must not include separe type
|
||||
FIX: External user must not be able to edit its discounts
|
||||
FIX: Failed to export contact categories with contact extra fields
|
||||
FIX: header title in commercial area
|
||||
FIX: HT and TTC price should always be displayed together
|
||||
FIX: incoterms
|
||||
FIX: incoterms do not output into crabe invoice PDF
|
||||
FIX: in PgSQL no quote "word style" is permitted around column name
|
||||
FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
|
||||
FIX: margin tab on customer card must filter on current entity invoices
|
||||
FIX: missing column into SQL on thridparty list
|
||||
FIX: only show projects of related third if external user
|
||||
FIX: PgSQL Module Ressource list crash #5637
|
||||
FIX: php Strict
|
||||
FIX: Regression when deleting product
|
||||
FIX: Security to restrict email sending was not efficient
|
||||
FIX: tag for date rfc in odt substitution
|
||||
FIX: Update intervention lline crash with PgSQL
|
||||
FIX: update limit stock on product stock
|
||||
FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15)
|
||||
FIX: wrong test on dict.php
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.4 compared to 3.9.3 *****
|
||||
FIX: #2853
|
||||
FIX: #3128
|
||||
FIX: #4447
|
||||
FIX: #5128 if create method return duplicated code error not use GETPOST in order to get a new code
|
||||
FIX: #5340
|
||||
FIX: #5473
|
||||
FIX: #5474 Country_id of "Don" object is still empty
|
||||
FIX: #5534
|
||||
FIX: #5535 bad dependency.
|
||||
FIX: #5537 AJAX project search does not work properly
|
||||
FIX: #5540 getFormMail is not registered as addReplace hook
|
||||
FIX: #5544 Disabled Contact still appear in lists to send emails
|
||||
FIX: #5549 getNomUrl tooltips show Order info even if user has no rights to read them
|
||||
FIX: #5568
|
||||
FIX: #5594
|
||||
FIX: #5629 PgSQL Interger string stylish error
|
||||
FIX: #5651
|
||||
FIX: #5660
|
||||
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
|
||||
FIX: #5907
|
||||
FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them
|
||||
FIX: #6051
|
||||
FIX: #6088
|
||||
FIX: Can correct stock of lot using eatby or sell by date
|
||||
FIX: Can make a movement on "out of sell" products
|
||||
FIX: cannot update bank account on invoice if module order not activated
|
||||
FIX: Can't create withdrawal document
|
||||
FIX: delete contract extrafields on contract deletion
|
||||
FIX: Direction of movement lost if an error occurs
|
||||
FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object
|
||||
FIX: export extrafields must not include separe type
|
||||
FIX: External user must not be able to edit its discounts
|
||||
FIX: Failed to export contact categories with contact extra fields
|
||||
FIX: header title in commercial area
|
||||
FIX: HT and TTC price should always be displayed together
|
||||
FIX: incoterms
|
||||
FIX: incoterms do not output into crabe invoice PDF
|
||||
FIX: in PgSQL no quote "word style" is permitted around column name
|
||||
FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
|
||||
FIX: margin tab on customer card must filter on current entity invoices
|
||||
FIX: missing column into SQL on thridparty list
|
||||
FIX: only show projects of related third if external user
|
||||
FIX: PgSQL Module Ressource list crash #5637
|
||||
FIX: php Strict
|
||||
FIX: Regression when deleting product
|
||||
FIX: Security to restrict email sending was not efficient
|
||||
FIX: tag for date rfc in odt substitution
|
||||
FIX: Update intervention lline crash with PgSQL
|
||||
FIX: update limit stock on product stock
|
||||
FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15)
|
||||
FIX: wrong test on dict.php
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.3 compared to 3.9.2 *****
|
||||
FIX: #4383 $userid not defined
|
||||
FIX: #4448 $filebonprev is not used, $this->filename now
|
||||
|
||||
@@ -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>';
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -753,8 +753,9 @@ else
|
||||
$sendingmode=$conf->global->MAIN_MAIL_SENDMODE;
|
||||
if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function
|
||||
|
||||
// MAILING_NO_USING_PHPMAIL may be defined or not
|
||||
// MAILING_LIMIT_SENDBYWEB is always defined to something != 0, MAILING_LIMIT_SENDBYCLI may be defined ot not.
|
||||
// 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 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.
|
||||
@@ -768,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');
|
||||
@@ -782,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)
|
||||
@@ -794,7 +795,7 @@ else
|
||||
}
|
||||
$text.=$langs->trans('ConfirmSendingEmailing').'<br>';
|
||||
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,270);
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('SendMailing'),$text,'sendallconfirmed',$formquestion,'',1,300);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -832,23 +833,28 @@ else
|
||||
print $langs->trans("TotalNbOfDistinctRecipients");
|
||||
print '</td><td colspan="3">';
|
||||
$nbemail = ($object->nbemail?$object->nbemail:img_warning('').' <font class="warning">'.$langs->trans("NoTargetYet").'</font>');
|
||||
if ($object->statut != 3 && !empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
|
||||
if ($object->statut != 3 && is_numeric($nbemail))
|
||||
{
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
|
||||
{
|
||||
$text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
$text=$langs->trans('NotEnoughPermissions');
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print $nbemail;
|
||||
$text='';
|
||||
if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail)
|
||||
{
|
||||
if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0)
|
||||
{
|
||||
$text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB);
|
||||
}
|
||||
else
|
||||
{
|
||||
$text.=$langs->trans('NotEnoughPermissions');
|
||||
}
|
||||
}
|
||||
if ($text)
|
||||
{
|
||||
print $form->textwithpicto($nbemail,$text,1,'warning');
|
||||
}
|
||||
else
|
||||
{
|
||||
print $nbemail;
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2349,7 +2349,8 @@ if ($action == 'create')
|
||||
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 +3745,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;
|
||||
@@ -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)."";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -899,7 +903,7 @@ if ($action == 'create')
|
||||
// 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>";
|
||||
}
|
||||
@@ -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>';
|
||||
@@ -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);
|
||||
|
||||
@@ -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,$offset);
|
||||
//print $sql;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -251,11 +251,16 @@ $dolibarr_main_restrict_os_commands='mysqldump, mysql, pg_dump, pgrestore';
|
||||
$dolibarr_nocsrfcheck='0';
|
||||
|
||||
// dolibarr_mailing_limit_sendbyweb
|
||||
// Can set a limit for mailing send by web. Can be used for a restricted mode.
|
||||
// Default value: 0 (use database value if exist)
|
||||
// Examples:
|
||||
// $dolibarr_mailing_limit_sendbyweb='0';
|
||||
// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
|
||||
// Default value: '25'
|
||||
// Examples: '-1' (sending by web is forbidden)
|
||||
// $dolibarr_mailing_limit_sendbyweb='25';
|
||||
|
||||
// dolibarr_mailing_limit_sendbycli
|
||||
// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level.
|
||||
// Default value: '0' (no hard limit, use soft database value if exists)
|
||||
// Examples: '-1' (sending by cli is forbidden)
|
||||
// $dolibarr_mailing_limit_sendbycli='0';
|
||||
|
||||
|
||||
//##################
|
||||
@@ -274,18 +279,6 @@ $dolibarr_nocsrfcheck='0';
|
||||
// Examples:
|
||||
// $dolibarr_main_limit_users='0';
|
||||
|
||||
// dolibarr_mailing_limit_sendbyweb
|
||||
// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
|
||||
// Default value: '0' (no overwrite, use database value if exists)
|
||||
// Examples: '-1' (sending by web is forbidden)
|
||||
// $dolibarr_mailing_limit_sendbyweb='0';
|
||||
|
||||
// dolibarr_mailing_limit_sendbycli
|
||||
// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level.
|
||||
// Default value: '0' (no overwrite, use database value if exists)
|
||||
// Examples: '-1' (sending by cli is forbidden)
|
||||
// $dolibarr_mailing_limit_sendbycli='0';
|
||||
|
||||
// dolibarr_strict_mode
|
||||
// Set this to 1 to enable the PHP strict mode. For dev environment only.
|
||||
// Default value: 0 (use database value if exist)
|
||||
|
||||
@@ -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>';
|
||||
|
||||
@@ -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,37 +475,46 @@ 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;
|
||||
$tmparray = explode(',', $this->addr_to);
|
||||
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
|
||||
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10;
|
||||
$tmparray1 = explode(',', $this->addr_to);
|
||||
if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)
|
||||
{
|
||||
$this->error = 'Too much recipients in to:';
|
||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
$tmparray = explode(',', $this->addr_cc);
|
||||
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
|
||||
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)
|
||||
{
|
||||
$this->error = 'Too much recipients in cc:';
|
||||
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
$tmparray = explode(',', $this->addr_bcc);
|
||||
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
|
||||
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)
|
||||
{
|
||||
$this->error = 'Too much recipients in bcc:';
|
||||
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')
|
||||
@@ -546,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();
|
||||
@@ -866,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
|
||||
{
|
||||
|
||||
@@ -323,16 +323,40 @@ class ExtraFields
|
||||
|
||||
$table=$elementtype.'_extrafields';
|
||||
|
||||
$error=0;
|
||||
|
||||
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
||||
{
|
||||
$result=$this->db->DDLDropField(MAIN_DB_PREFIX.$table,$attrname); // This also drop the unique key
|
||||
$result=$this->delete_label($attrname,$elementtype);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
|
||||
$result=$this->delete_label($attrname,$elementtype);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "SELECT COUNT(rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql.= " WHERE elementtype = '".$elementtype."'";
|
||||
$sql.= " AND name = '".$attrname."'";
|
||||
//$sql.= " AND entity IN (0,".$conf->entity.")"; Do not test on entity here. We want to see if there is still on field remaning in other entities before deleting field in table
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj->nb <= 0)
|
||||
{
|
||||
$result=$this->db->DDLDropField(MAIN_DB_PREFIX.$table,$attrname); // This also drop the unique key
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
@@ -715,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)
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -110,8 +110,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
{
|
||||
$this->posxtva=99;
|
||||
$this->posxup=114;
|
||||
$this->posxqty=133;
|
||||
$this->posxunit=150;
|
||||
$this->posxqty=130;
|
||||
$this->posxunit=147;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -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
|
||||
|
||||
@@ -119,8 +119,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
{
|
||||
$this->posxtva=99;
|
||||
$this->posxup=114;
|
||||
$this->posxqty=133;
|
||||
$this->posxunit=150;
|
||||
$this->posxqty=130;
|
||||
$this->posxunit=147;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -108,8 +108,8 @@ class pdf_azur extends ModelePDFPropales
|
||||
{
|
||||
$this->posxtva=99;
|
||||
$this->posxup=114;
|
||||
$this->posxqty=133;
|
||||
$this->posxunit=150;
|
||||
$this->posxqty=130;
|
||||
$this->posxunit=147;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
@@ -102,8 +102,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
if($conf->global->PRODUCT_USE_UNITS) {
|
||||
$this->posxtva=99;
|
||||
$this->posxup=114;
|
||||
$this->posxqty=133;
|
||||
$this->posxunit=150;
|
||||
$this->posxqty=130;
|
||||
$this->posxunit=147;
|
||||
}
|
||||
//if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup;
|
||||
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
|
||||
|
||||
@@ -111,8 +111,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
{
|
||||
$this->posxtva=99;
|
||||
$this->posxup=114;
|
||||
$this->posxqty=133;
|
||||
$this->posxunit=150;
|
||||
$this->posxqty=130;
|
||||
$this->posxunit=147;
|
||||
} else {
|
||||
$this->posxtva=112;
|
||||
$this->posxup=126;
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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.3');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.6');
|
||||
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
|
||||
@@ -1373,7 +1373,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 +1437,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 +1454,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 +2755,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 +2764,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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -870,7 +870,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 +1844,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 +1866,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 +1998,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 +2139,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');
|
||||
|
||||
@@ -434,6 +435,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 +790,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;
|
||||
|
||||
@@ -276,3 +276,14 @@ DELETE FROM llx_c_shipment_mode where code IN (select code from tmp_c_shipment_m
|
||||
drop table tmp_c_shipment_mode;
|
||||
|
||||
|
||||
-- Clean product prices
|
||||
--delete from llx_product_price where date_price between '2017-04-20 06:51:00' and '2017-04-20 06:51:05';
|
||||
-- Set product prices into llx_product with last price into llx_product_prices
|
||||
--update llx_product as p set
|
||||
-- p.price = (select pp.price from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
|
||||
-- p.price_ttc = (select pp.price_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
|
||||
-- p.price_min = (select pp.price_min from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
|
||||
-- p.price_min_ttc = (select pp.price_min_ttc from llx_product_price as pp where pp.price_level = 1 and pp.fk_product = p.rowid order by pp.tms desc limit 1),
|
||||
-- p.tva_tx = 0
|
||||
-- where price = 17.5
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ print '<h3>'.$langs->trans("Repair").'</h3>';
|
||||
|
||||
print 'Option restore_thirdparties_logos is '.(GETPOST('restore_thirdparties_logos')?GETPOST('restore_thirdparties_logos'):'0').'<br>'."\n";
|
||||
print 'Option clean_linked_elements is '.(GETPOST('clean_linked_elements')?GETPOST('clean_linked_elements'):'0').'<br>'."\n";
|
||||
print 'Option clean_orphelin_dir (1 or confirmed) is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').'<br>'."\n";
|
||||
print 'Option clean_product_stock_batch (1 or confirmed) is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').'<br>'."\n";
|
||||
print 'Option clean_orphelin_dir (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_orphelin_dir')?GETPOST('clean_orphelin_dir'):'0').'<br>'."\n";
|
||||
print 'Option clean_product_stock_batch (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_product_stock_batch')?GETPOST('clean_product_stock_batch'):'0').'<br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
|
||||
@@ -252,10 +252,34 @@ if ($ok)
|
||||
if (! in_array($code,array_keys($arrayoffieldsfound)))
|
||||
{
|
||||
print 'Found field '.$code.' declared into '.MAIN_DB_PREFIX.'extrafields table but not found into desc of table '.$tableextra." -> ";
|
||||
$type=$extrafields->attribute_type[$code]; $value=$extrafields->attribute_size[$code]; $attribute=''; $default=''; $extra=''; $null='null';
|
||||
$type=$extrafields->attribute_type[$code]; $length=$extrafields->attribute_size[$code]; $attribute=''; $default=''; $extra=''; $null='null';
|
||||
|
||||
if ($type=='boolean') {
|
||||
$typedb='int';
|
||||
$lengthdb='1';
|
||||
} elseif($type=='price') {
|
||||
$typedb='double';
|
||||
$lengthdb='24,8';
|
||||
} elseif($type=='phone') {
|
||||
$typedb='varchar';
|
||||
$lengthdb='20';
|
||||
}elseif($type=='mail') {
|
||||
$typedb='varchar';
|
||||
$lengthdb='128';
|
||||
} elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){
|
||||
$typedb='text';
|
||||
$lengthdb='';
|
||||
} elseif ($type=='link') {
|
||||
$typedb='int';
|
||||
$lengthdb='11';
|
||||
} else {
|
||||
$typedb=$type;
|
||||
$lengthdb=$length;
|
||||
}
|
||||
|
||||
$field_desc=array(
|
||||
'type'=>$type,
|
||||
'value'=>$value,
|
||||
'type'=>$typedb,
|
||||
'value'=>$lengthdb,
|
||||
'attribute'=>$attribute,
|
||||
'default'=>$default,
|
||||
'extra'=>$extra,
|
||||
@@ -523,14 +547,17 @@ if ($ok && GETPOST('clean_orphelin_dir'))
|
||||
// clean_linked_elements: Check and clean linked elements
|
||||
if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
{
|
||||
print '<tr><td colspan="2"><br>Clean table product_batch</td></tr>';
|
||||
$methodtofix=GETPOST('methodtofix')?GETPOST('methodtofix'):'updatestock';
|
||||
|
||||
print '<tr><td colspan="2"><br>Clean table product_batch, methodtofix='.$methodtofix.' (possible values: updatestock or updatebatch)</td></tr>';
|
||||
|
||||
$sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
|
||||
$sql.=" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps LEFT JOIN ".MAIN_DB_PREFIX."product_batch as pb ON ps.rowid = pb.fk_product_stock";
|
||||
$sql.=" WHERE p.rowid = ps.fk_product";
|
||||
$sql.=" AND p.tobatch = 1";
|
||||
$sql.=" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
|
||||
$sql.=" HAVING reel != SUM(pb.qty)";
|
||||
$sql.=" HAVING reel != SUM(pb.qty) or SUM(pb.qty) IS NULL";
|
||||
print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -542,13 +569,11 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
print '<tr><td>'.$obj->rowid.'-'.$obj->ref.'-'.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' != '.$obj->reelbatch;
|
||||
print '<tr><td>Product '.$obj->rowid.'-'.$obj->ref.' in warehose '.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' (product_stock.reel) != '.($obj->reelbatch?$obj->reelbatch:'0').' (sum product_batch)';
|
||||
|
||||
// Fix
|
||||
if ($obj->reel != $obj->reelbatch)
|
||||
{
|
||||
$methodtofix='updatestock';
|
||||
|
||||
if ($methodtofix == 'updatebatch')
|
||||
{
|
||||
// Method 1
|
||||
@@ -570,7 +595,7 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
if ($methodtofix == 'updatestock')
|
||||
{
|
||||
// Method 2
|
||||
print ' -> Update qty of stock with qty = '.$obj->reelbatch.' for ps.rowid = '.$obj->psrowid;
|
||||
print ' -> Update qty of product_stock with qty = '.($obj->reelbatch?$obj->reelbatch:'0').' for ps.rowid = '.$obj->psrowid;
|
||||
if (GETPOST('clean_product_stock_batch') == 'confirmed')
|
||||
{
|
||||
$error=0;
|
||||
@@ -578,11 +603,11 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
$db->begin();
|
||||
|
||||
$sql2 ="UPDATE ".MAIN_DB_PREFIX."product_stock";
|
||||
$sql2.=" SET reel = ".$obj->reelbatch." WHERE rowid = ".$obj->psrowid;
|
||||
$sql2.=" SET reel = ".($obj->reelbatch?$obj->reelbatch:'0')." WHERE rowid = ".$obj->psrowid;
|
||||
$resql2=$db->query($sql2);
|
||||
if ($resql2)
|
||||
{
|
||||
// We update product stock, so we must update product.stock too.
|
||||
// We update product_stock, so we must field stock into product too.
|
||||
$sql3='UPDATE llx_product p SET p.stock= (SELECT SUM(ps.reel) FROM llx_product_stock ps WHERE ps.fk_product = p.rowid)';
|
||||
$resql3=$db->query($sql3);
|
||||
if (! $resql3)
|
||||
@@ -608,6 +633,10 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan="2">Nothing to do</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -618,6 +647,34 @@ if ($ok && GETPOST('clean_product_stock_batch'))
|
||||
}
|
||||
|
||||
|
||||
// clean_linked_elements: Check and clean linked elements
|
||||
if ($ok && GETPOST('clean_product_stock_negative_if_batch'))
|
||||
{
|
||||
print '<tr><td colspan="2"><br>Clean table product_batch, methodtofix='.$methodtofix.' (possible values: updatestock or updatebatch)</td></tr>';
|
||||
|
||||
$sql ="SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product_batch as pb";
|
||||
$sql.=" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
|
||||
$sql.=" AND p.tobatch = 1";
|
||||
$sql.=" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
|
||||
$sql.=" HAVING reel != SUM(pb.qty)";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj=$db->fetch_object($resql);
|
||||
print '<tr><td>'.$obj->rowid.'-'.$obj->ref.'-'.$obj->fk_entrepot.' -> '.$obj->psrowid.': '.$obj->reel.' != '.$obj->reelbatch;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -560,7 +560,7 @@ Permission34=Delete products
|
||||
Permission36=See/manage hidden products
|
||||
Permission38=Export products
|
||||
Permission41=Read projects and tasks (shared project and projects i'm contact for). Can also enter time consumed on assigned tasks (timesheet)
|
||||
Permission42=Create/modify projects (shared project and projects i'm contact for)
|
||||
Permission42=Create/modify projects (shared project and projects i'm contact for). Can also create tasks and assign users to project and tasks
|
||||
Permission44=Delete projects (shared project and projects i'm contact for)
|
||||
Permission45=Export projects
|
||||
Permission61=Read interventions
|
||||
@@ -663,7 +663,7 @@ PermissionAdvanced253=Create/modify internal/external users and permissions
|
||||
Permission254=Create/modify external users only
|
||||
Permission255=Modify other users password
|
||||
Permission256=Delete or disable other users
|
||||
Permission262=Extend access to all third parties (not only those linked to user). Not effective for external users (always limited to themselves).
|
||||
Permission262=Extend access to all third parties (not only third parties that user is a sale representative). Not effective for external users (always limited to themselves for proposals, orders, invoices, contracts, etc). Not effective for projects (only rules on project permissions, visibility and assignement matters).
|
||||
Permission271=Read CA
|
||||
Permission272=Read invoices
|
||||
Permission273=Issue invoices
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Dolibarr language file - Source file is en_US - categories
|
||||
Rubrique=Tag/Category
|
||||
Rubriques=Tags/Categories
|
||||
RubriquesTransactions=Tags/Categories of transactions
|
||||
categories=tags/categories
|
||||
NoCategoryYet=No tag/category of this type created
|
||||
In=In
|
||||
|
||||
@@ -170,12 +170,15 @@ ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship
|
||||
ErrorFileMustHaveFormat=File must have format %s
|
||||
ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first.
|
||||
ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled.
|
||||
ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order.
|
||||
ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice.
|
||||
ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment.
|
||||
ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal.
|
||||
ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enough for product %s to add it into a new order.
|
||||
ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enough for product %s to add it into a new invoice.
|
||||
ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enough for product %s to add it into a new shipment.
|
||||
ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s to add it into a new proposal.
|
||||
ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'.
|
||||
ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information.
|
||||
ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter time consumed.
|
||||
ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong format.
|
||||
ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (<strong>%s</strong>) does not match expected name syntax: <strong>%s</strong>
|
||||
|
||||
# Warnings
|
||||
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.
|
||||
|
||||
@@ -35,7 +35,7 @@ MailingStatusSentPartialy=Sent partialy
|
||||
MailingStatusSentCompletely=Sent completely
|
||||
MailingStatusError=Error
|
||||
MailingStatusNotSent=Not sent
|
||||
MailSuccessfulySent=Email successfully sent (from %s to %s)
|
||||
MailSuccessfulySent=Email successfully accepted for delivery (from %s to %s)
|
||||
MailingSuccessfullyValidated=EMailing successfully validated
|
||||
MailUnsubcribe=Unsubscribe
|
||||
MailingStatusNotContact=Don't contact anymore
|
||||
|
||||
@@ -447,6 +447,7 @@ DeletePicture=Picture delete
|
||||
ConfirmDeletePicture=Confirm picture deletion?
|
||||
Login=Login
|
||||
CurrentLogin=Current login
|
||||
EnterLoginDetail=Enter login details
|
||||
January=January
|
||||
February=February
|
||||
March=March
|
||||
|
||||
@@ -27,7 +27,7 @@ DeleteAMailing=Delete an emailing
|
||||
PreviewMailing=Preview emailing
|
||||
CreateMailing=Create emailing
|
||||
TestMailing=Test email
|
||||
ValidMailing=Valid emailing
|
||||
ValidMailing=Validate emailing
|
||||
MailingStatusDraft=Draft
|
||||
MailingStatusValidated=Validated
|
||||
MailingStatusSent=Sent
|
||||
|
||||
@@ -576,9 +576,10 @@ if (! defined('NOLOGIN'))
|
||||
{
|
||||
// We are already into an authenticated session
|
||||
$login=$_SESSION["dol_login"];
|
||||
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login, LOG_DEBUG);
|
||||
$entity=$_SESSION["dol_entity"];
|
||||
dol_syslog("This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG);
|
||||
|
||||
$resultFetchUser=$user->fetch('',$login);
|
||||
$resultFetchUser=$user->fetch('',$login,'',1,($entity > 0 ? $entity : -1));
|
||||
if ($resultFetchUser <= 0)
|
||||
{
|
||||
// Account has been removed after login
|
||||
@@ -1700,8 +1701,10 @@ function left_menu($menu_array_before, $helppagename='', $notused='', $menu_arra
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
|
||||
if ($doliurl) print '<a class="help" target="_blank" href="'.$doliurl.'">';
|
||||
else print '<span class="help">';
|
||||
print $appli;
|
||||
if ($doliurl) print '</a>';
|
||||
else print '</span>';
|
||||
print '</div>'."\n";
|
||||
|
||||
// Link to bugtrack
|
||||
|
||||
@@ -115,6 +115,7 @@ $sql = "SELECT";
|
||||
if ($agentid > 0) $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,";
|
||||
$sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,";
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this)
|
||||
$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
|
||||
$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge" ;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
@@ -124,6 +125,7 @@ $sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " AND sc.fk_soc = f.fk_soc";
|
||||
$sql.= " AND (d.product_type = 0 OR d.product_type = 1)";
|
||||
if (! empty($conf->global->AGENT_CONTACT_TYPE))
|
||||
|
||||
@@ -164,6 +164,7 @@ $sql = "SELECT";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,";
|
||||
if ($client) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
|
||||
$sql.= " sum(d.total_ht) as selling_price,";
|
||||
// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this)
|
||||
$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
|
||||
$sql.= " sum(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
|
||||
@@ -109,7 +109,7 @@ function marges_prepare_head()
|
||||
* @param float $localtax2_tx Vat rate special 2 (not used)
|
||||
* @param int $fk_pa Id of buying price (prefer set this to 0 and provide $paht instead. With id, buying price may have change)
|
||||
* @param float $paht Buying price without tax
|
||||
* @return array Array of margin info
|
||||
* @return array Array of margin info (buying price, marge rate, marque rate)
|
||||
*/
|
||||
function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $fk_pa, $paht)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta
|
||||
}
|
||||
else
|
||||
{
|
||||
$paht_ret = $paht;
|
||||
$paht_ret = $paht;
|
||||
}
|
||||
|
||||
// Calculate selling unit price including line discount
|
||||
|
||||
@@ -166,6 +166,7 @@ $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,"
|
||||
if ($id > 0) $sql.= " d.fk_product,";
|
||||
if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
|
||||
$sql.= " SUM(d.total_ht) as selling_price,";
|
||||
// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this)
|
||||
$sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
|
||||
$sql.= " SUM(".$db->ifsql('d.total_ht < 0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
|
||||
@@ -155,7 +155,6 @@ $genPriceOptions = function($level) use ($price_options) {
|
||||
|
||||
return $return;
|
||||
};
|
||||
|
||||
?>
|
||||
|
||||
<table class="noborder">
|
||||
@@ -173,7 +172,8 @@ $genPriceOptions = function($level) use ($price_options) {
|
||||
<td class="fieldrequired" style="text-align: center"><?php
|
||||
echo $langs->trans('SellingPrice').' '.$i;
|
||||
// Label of price
|
||||
if (! empty($conf->global->{"PRODUIT_MULTIPRICES_LABEL$i"})) {
|
||||
$keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i;
|
||||
if (! empty($conf->global->$keyforlabel)) {
|
||||
print ' - '.$langs->trans($conf->global->$keyforlabel);
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -42,8 +42,6 @@ $oldvatrate=GETPOST('oldvatrate');
|
||||
$newvatrate=GETPOST('newvatrate');
|
||||
//$price_base_type=GETPOST('price_base_type');
|
||||
|
||||
$objectstatic = new Product($db);
|
||||
$objectstatic2 = new ProductFournisseur($db);
|
||||
|
||||
|
||||
/*
|
||||
@@ -87,6 +85,7 @@ if ($action == 'convert')
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$objectstatic = new Product($db); // Object init must be into loop to avoid to get value of previous step
|
||||
$ret=$objectstatic->fetch($obj->rowid);
|
||||
if ($ret > 0)
|
||||
{
|
||||
@@ -150,7 +149,8 @@ if ($action == 'convert')
|
||||
if ($ret < 0 || $retm < 0) $error++;
|
||||
else $nbrecordsmodified++;
|
||||
}
|
||||
|
||||
unset($objectstatic);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,7 @@ if ($action == 'convert')
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step
|
||||
$ret=$objectstatic2->fetch_product_fournisseur_price($obj->rowid);
|
||||
if ($ret > 0)
|
||||
{
|
||||
@@ -207,6 +208,8 @@ if ($action == 'convert')
|
||||
if ($ret < 0 || $retm < 0) $error++;
|
||||
else $nbrecordsmodified++;
|
||||
}
|
||||
unset($objectstatic2);
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* Copyright (C) 2014 Henry Florian <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2016 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2014 Ion agorria <ion@agorria.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
|
||||
@@ -816,7 +816,7 @@ class Product extends CommonObject
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref))
|
||||
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref))
|
||||
{
|
||||
// We remove directory
|
||||
if ($conf->product->dir_output)
|
||||
|
||||
@@ -44,6 +44,7 @@ $ref = GETPOST('ref');
|
||||
$mode = (GETPOST('mode') ? GETPOST('mode') : 'byunit');
|
||||
$error = 0;
|
||||
$mesg = '';
|
||||
$graphfiles=array();
|
||||
|
||||
$socid='';
|
||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||
@@ -57,7 +58,7 @@ $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','',
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
@@ -68,7 +69,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
llxHeader("",$langs->trans("ProductStatistics"));
|
||||
|
||||
$type = GETPOST('type');
|
||||
|
||||
|
||||
$helpurl='';
|
||||
if ($type == '0')
|
||||
{
|
||||
@@ -88,13 +89,13 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
//$title=$langs->trans("StatisticsOfProductsOrServices");
|
||||
$title=$langs->trans("Statistics");
|
||||
}
|
||||
|
||||
|
||||
print load_fiche_titre($title, $mesg,'title_products.png');
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $object->fetch($id,$ref);
|
||||
|
||||
|
||||
$title = $langs->trans('ProductServiceCard');
|
||||
$helpurl = '';
|
||||
$shortlabel = dol_trunc($object->label,16);
|
||||
@@ -111,8 +112,8 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
|
||||
llxHeader('', $title, $helpurl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($result && (! empty($id) || ! empty($ref)))
|
||||
{
|
||||
$head=product_prepare_head($object);
|
||||
@@ -122,21 +123,21 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
dol_fiche_head($head, 'stats', $titre, 0, $picto);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref');
|
||||
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
if (GETPOST('id') == 'all')
|
||||
{
|
||||
$h=0;
|
||||
$head = array();
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php?id=all';
|
||||
$head[$h][1] = $langs->trans("Chart");
|
||||
$head[$h][2] = 'chart';
|
||||
$h++;
|
||||
|
||||
|
||||
$title = $langs->trans("ListProductServiceByPopularity");
|
||||
if ((string) $type == '1') {
|
||||
$title = $langs->trans("ListServiceByPopularity");
|
||||
@@ -144,49 +145,49 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
if ((string) $type == '0') {
|
||||
$title = $langs->trans("ListProductByPopularity");
|
||||
}
|
||||
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != ''?'?type='.$type:'');
|
||||
$head[$h][1] = $title;
|
||||
$head[$h][2] = 'popularityprop';
|
||||
$h++;
|
||||
|
||||
dol_fiche_head($head,'chart',$langs->trans("Statistics"));
|
||||
|
||||
dol_fiche_head($head,'chart',$langs->trans("Statistics"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($result || GETPOST('id') == 'all')
|
||||
{
|
||||
if (GETPOST('id') == 'all')
|
||||
{
|
||||
// Choice of type of product
|
||||
if (! empty($conf->dol_use_jmobile)) print "\n".'<div class="fichecenter"><div class="nowrap">'."\n";
|
||||
|
||||
|
||||
if ((string) $type != '0') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).'&type=0'.($mode?'&mode='.$mode:'').'">';
|
||||
else print img_picto('','tick').' ';
|
||||
print $langs->trans("Products");
|
||||
if ((string) $type != '0') print '</a>';
|
||||
|
||||
|
||||
if (! empty($conf->dol_use_jmobile)) print '</div>'."\n".'<div class="nowrap">'."\n";
|
||||
else print ' / ';
|
||||
|
||||
|
||||
if ((string) $type != '1') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).'&type=1'.($mode?'&mode='.$mode:'').'">';
|
||||
else print img_picto('','tick').' ';
|
||||
print $langs->trans("Services");
|
||||
if ((string) $type != '1') print '</a>';
|
||||
|
||||
|
||||
if (! empty($conf->dol_use_jmobile)) print '</div>'."\n".'<div class="nowrap">'."\n";
|
||||
else print ' / ';
|
||||
|
||||
|
||||
if ((string) $type == '0' || (string) $type == '1') print '<a href="'.$_SERVER["PHP_SELF"].'?id='.(GETPOST('id')?GETPOST('id'):$object->id).($mode?'&mode='.$mode:'').'">';
|
||||
else print img_picto('','tick').' ';
|
||||
print $langs->trans("ProductsAndServices");
|
||||
if ((string) $type == '0' || (string) $type == '1') print '</a>';
|
||||
|
||||
|
||||
if (! empty($conf->dol_use_jmobile)) print '</div></div>';
|
||||
else print '<br>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
// Choice of stats mode (byunit or bynumber)
|
||||
if (! empty($conf->dol_use_jmobile)) print "\n".'<div class="fichecenter"><div class="nowrap">'."\n";
|
||||
|
||||
@@ -222,25 +223,25 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($conf->propal->enabled) {
|
||||
$graphfiles['propal']=array('modulepart'=>'productstats_proposals',
|
||||
'file' => $object->id.'/propal12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png',
|
||||
'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsProposals"):$langs->transnoentitiesnoconv("NumberOfProposals")));
|
||||
}
|
||||
|
||||
|
||||
if($conf->supplier_proposal->enabled) {
|
||||
$graphfiles['proposalssuppliers']=array('modulepart'=>'productstats_proposalssuppliers',
|
||||
'file' => $object->id.'/proposalssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png',
|
||||
'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierProposals"):$langs->transnoentitiesnoconv("NumberOfSupplierProposals")));
|
||||
}
|
||||
|
||||
|
||||
if($conf->order->enabled) {
|
||||
$graphfiles['orders']=array('modulepart'=>'productstats_orders',
|
||||
'file' => $object->id.'/orders12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png',
|
||||
'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerOrders"):$langs->transnoentitiesnoconv("NumberOfCustomerOrders")));
|
||||
}
|
||||
|
||||
|
||||
if($conf->fournisseur->enabled) {
|
||||
$graphfiles['orderssuppliers']=array('modulepart'=>'productstats_orderssuppliers',
|
||||
'file' => $object->id.'/orderssuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png',
|
||||
@@ -251,7 +252,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
$graphfiles['invoices']=array('modulepart'=>'productstats_invoices',
|
||||
'file' => $object->id.'/invoices12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png',
|
||||
'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsCustomerInvoices"):$langs->transnoentitiesnoconv("NumberOfCustomerInvoices")));
|
||||
|
||||
|
||||
$graphfiles['invoicessuppliers']=array('modulepart'=>'productstats_invoicessuppliers',
|
||||
'file' => $object->id.'/invoicessuppliers12m'.((string) $type != '' ? '_type'.$type : '').'_'.$mode.'.png',
|
||||
'label' => ($mode=='byunit'?$langs->transnoentitiesnoconv("NumberOfUnitsSupplierInvoices"):$langs->transnoentitiesnoconv("NumberOfSupplierInvoices")));
|
||||
@@ -282,10 +283,10 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
if ($key == 'proposalssuppliers') $graph_data = $object->get_nb_propalsupplier($socid,$mode,((string) $type != '' ? $type : -1));
|
||||
if ($key == 'invoicessuppliers') $graph_data = $object->get_nb_achat($socid,$mode,((string) $type != '' ? $type : -1));
|
||||
if ($key == 'orderssuppliers') $graph_data = $object->get_nb_ordersupplier($socid,$mode,((string) $type != '' ? $type : -1));
|
||||
|
||||
|
||||
// TODO Save cachefile $graphfiles[$key]['file']
|
||||
}
|
||||
|
||||
|
||||
if (is_array($graph_data))
|
||||
{
|
||||
$px->SetData($graph_data);
|
||||
@@ -383,7 +384,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all')
|
||||
print '<div class="clear"><div class="fichecenter"><br></div></div>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (GETPOST('id') == 'all')
|
||||
{
|
||||
dol_fiche_end();
|
||||
|
||||
@@ -372,7 +372,7 @@ else
|
||||
{
|
||||
$limit = $conf->global->PRODUIT_LIMIT_SIZE;
|
||||
}
|
||||
print $form->select_produits($id_product,'productid',$filtertype,$limit);
|
||||
print $form->select_produits($id_product,'productid',$filtertype,$limit,0,-1);
|
||||
print '</td>';
|
||||
// Batch number
|
||||
if ($conf->productbatch->enabled)
|
||||
|
||||
@@ -68,7 +68,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Security check
|
||||
$socid=GETPOST('socid');
|
||||
if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
$result = restrictedArea($user, 'projet', $object->id,'projet&project');
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014-2017 Marcos García <marcosgdf@gmail.com>
|
||||
* 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
|
||||
@@ -292,7 +293,7 @@ class Project extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref))
|
||||
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref))
|
||||
{
|
||||
// We remove directory
|
||||
if ($conf->projet->dir_output)
|
||||
@@ -1689,17 +1690,21 @@ class Project extends CommonObject
|
||||
*/
|
||||
function load_state_board()
|
||||
{
|
||||
global $conf;
|
||||
global $user;
|
||||
|
||||
$this->nb=array();
|
||||
|
||||
$sql = "SELECT count(u.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."projet as u";
|
||||
$sql.= " WHERE";
|
||||
//$sql.= " WHERE u.fk_statut > 0";
|
||||
//$sql.= " AND employee != 0";
|
||||
$sql.= " u.entity IN (".getEntity('projet', 1).")";
|
||||
|
||||
|
||||
$sql = "SELECT DISTINCT
|
||||
count(p.rowid) as nb
|
||||
FROM ".MAIN_DB_PREFIX."projet AS p LEFT JOIN ".MAIN_DB_PREFIX."societe AS s ON p.fk_soc = s.rowid
|
||||
LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status AS cls ON p.fk_opp_status = cls.rowid
|
||||
WHERE p.entity IN (".getEntity('projet', 1).")";
|
||||
|
||||
if (! $user->rights->projet->all->lire) {
|
||||
$projectsListId = $this->getProjectsAuthorizedForUser($user,0,1);
|
||||
$sql .= "AND p.rowid IN (".$projectsListId.")";
|
||||
}
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
$result = restrictedArea($user, 'projet', $id,'projet&project');
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ $mine = (GETPOST('mode','alpha') == 'mine' ? 1 : 0);
|
||||
|
||||
// Security check
|
||||
$socid=0;
|
||||
if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
$result=restrictedArea($user,'projet',$id,'projet&project');
|
||||
|
||||
$object = new Project($db);
|
||||
|
||||
@@ -92,7 +92,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
|
||||
// Security check
|
||||
$socid=$object->socid;
|
||||
if ($user->societe_id > 0) $socid=$user->societe_id;
|
||||
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
|
||||
$result = restrictedArea($user, 'projet', $projectid, 'projet&project');
|
||||
|
||||
|
||||
@@ -612,7 +612,9 @@ foreach ($listofreferent as $key => $value)
|
||||
{
|
||||
$addform.='<div class="inline-block valignmiddle">';
|
||||
if ($testnew) $addform.='<a class="buttonxxx" href="'.$urlnew.'">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</a>';
|
||||
else $addform.='<a class="buttonxxx buttonRefused" disabled="disabled" href="#">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</a>';
|
||||
elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) {
|
||||
$addform.='<a class="buttonxxx buttonRefused" disabled="disabled" href="#">'.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).'</a>';
|
||||
}
|
||||
$addform.='<div>';
|
||||
}
|
||||
|
||||
@@ -954,7 +956,7 @@ foreach ($listofreferent as $key => $value)
|
||||
print '<td align="right">';
|
||||
if (empty($value['disableamount']))
|
||||
{
|
||||
if (! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht);
|
||||
if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht);
|
||||
}
|
||||
print '</td>';
|
||||
//if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print '<td align="right" width="100">'.$langs->trans("TotalTTC").' : '.price($total_ttc).'</td>';
|
||||
@@ -962,8 +964,7 @@ foreach ($listofreferent as $key => $value)
|
||||
print '<td align="right">';
|
||||
if (empty($value['disableamount']))
|
||||
{
|
||||
|
||||
if (! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc);
|
||||
if ($tablename != 'projet_task' || ! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc);
|
||||
}
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user