mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 09:01:40 +01:00
Compare commits
373 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8aa8051dc | ||
|
|
a7e1a45571 | ||
|
|
60486417c3 | ||
|
|
c9ee9c7a38 | ||
|
|
8f3f28c28f | ||
|
|
ac8a21a3d9 | ||
|
|
769c30de9d | ||
|
|
2b926978ae | ||
|
|
6540451078 | ||
|
|
3ea1345a5b | ||
|
|
0d35892003 | ||
|
|
8a8c2170cc | ||
|
|
599300dfec | ||
|
|
1e6e7af9f7 | ||
|
|
56cd154258 | ||
|
|
2f476aa0a0 | ||
|
|
47d7ea1813 | ||
|
|
47d5c5baad | ||
|
|
91fdb6a569 | ||
|
|
1997b029c7 | ||
|
|
753400ccf5 | ||
|
|
b83a4d4815 | ||
|
|
8127ced19b | ||
|
|
8bd2f9cfb5 | ||
|
|
0b3a2b744e | ||
|
|
cd992d553e | ||
|
|
db00ca9dd7 | ||
|
|
542dc8f98f | ||
|
|
497aa9c453 | ||
|
|
c80badafe0 | ||
|
|
3aebd50d39 | ||
|
|
85f03913fe | ||
|
|
a3260f3e14 | ||
|
|
825130d633 | ||
|
|
1d66d97032 | ||
|
|
df4bfc77a4 | ||
|
|
8fe8a1a6fd | ||
|
|
6fe9a8ee0d | ||
|
|
7e94d8ae52 | ||
|
|
878d5612a1 | ||
|
|
377d6dc290 | ||
|
|
2b9f4fed8d | ||
|
|
890579d13d | ||
|
|
3dab78afb7 | ||
|
|
d9ebc43cb6 | ||
|
|
6d85629495 | ||
|
|
0e12931d0f | ||
|
|
9690a0bc69 | ||
|
|
8b02d9e912 | ||
|
|
399aaf1459 | ||
|
|
e707f73067 | ||
|
|
8506df28d7 | ||
|
|
2868961661 | ||
|
|
ae945732be | ||
|
|
10e72d70ae | ||
|
|
fa1d8a3f34 | ||
|
|
6600993796 | ||
|
|
bcc92dbd62 | ||
|
|
ad3fd83478 | ||
|
|
2763374ff1 | ||
|
|
a2fecc2616 | ||
|
|
4ecf7d9493 | ||
|
|
f9dfe1bcfb | ||
|
|
a119cd3f36 | ||
|
|
c019857bda | ||
|
|
b020dbf96f | ||
|
|
1185e0f731 | ||
|
|
d6243a33af | ||
|
|
e9128db1aa | ||
|
|
e8c9a9c87d | ||
|
|
80c6716581 | ||
|
|
9de912ba12 | ||
|
|
930f492a14 | ||
|
|
665526a6e7 | ||
|
|
0ac5f38e02 | ||
|
|
4a9bf30bd1 | ||
|
|
89908052c0 | ||
|
|
53c1672b9f | ||
|
|
8b13f2ab81 | ||
|
|
f1870ae37d | ||
|
|
592d70d4ea | ||
|
|
218ae3dbd5 | ||
|
|
b7163bea5d | ||
|
|
01b361a98b | ||
|
|
fd0cd7257c | ||
|
|
b36b56b7a1 | ||
|
|
4a111234a0 | ||
|
|
e2d71b3215 | ||
|
|
0fbd626822 | ||
|
|
a79d440a9b | ||
|
|
78deb405b2 | ||
|
|
5046c20b81 | ||
|
|
8b28893fbe | ||
|
|
c4f3e872ca | ||
|
|
f0cfbb8b0d | ||
|
|
0511ba87f4 | ||
|
|
04d5a41e9c | ||
|
|
62c3f04392 | ||
|
|
feaf5266e9 | ||
|
|
2b75c81af9 | ||
|
|
d3986b4936 | ||
|
|
9c08abb52c | ||
|
|
185c03eea5 | ||
|
|
9614881bed | ||
|
|
dbb62f010d | ||
|
|
8de657a215 | ||
|
|
e20b0b2e7b | ||
|
|
21ad42afab | ||
|
|
99b33a70a3 | ||
|
|
dfda863b7e | ||
|
|
37f866c31f | ||
|
|
7a3f6b9acc | ||
|
|
de7b060e12 | ||
|
|
f25802520a | ||
|
|
a7d6289d4b | ||
|
|
d12700aeab | ||
|
|
77688cf988 | ||
|
|
b66aeabb88 | ||
|
|
49ae52c708 | ||
|
|
9fbd6f0b58 | ||
|
|
433ca88c43 | ||
|
|
aa65ebe136 | ||
|
|
43a8b9176f | ||
|
|
6e12d84f14 | ||
|
|
1eac98dc43 | ||
|
|
6691bef701 | ||
|
|
24cc745ae8 | ||
|
|
7a42514833 | ||
|
|
749f371d4e | ||
|
|
bee6b92a7b | ||
|
|
36ff4abe3c | ||
|
|
6012dff11e | ||
|
|
5f197cb1bb | ||
|
|
6c62b64b7c | ||
|
|
d4ac506d66 | ||
|
|
e5c2d07c53 | ||
|
|
05de9c19c3 | ||
|
|
5c2ce8a301 | ||
|
|
849dc8c836 | ||
|
|
bdc330ad6a | ||
|
|
85eedfa6e7 | ||
|
|
e121ab8c86 | ||
|
|
fe76902342 | ||
|
|
9142e3400b | ||
|
|
87cc60d647 | ||
|
|
c5728843a5 | ||
|
|
e260997e0b | ||
|
|
fef04f6921 | ||
|
|
bc2411098c | ||
|
|
0dafeb8e44 | ||
|
|
084efd03a3 | ||
|
|
61372f4650 | ||
|
|
049e588341 | ||
|
|
2d15b64f24 | ||
|
|
6bab2e0bd8 | ||
|
|
f425762e9d | ||
|
|
81970b8dd0 | ||
|
|
6e3404a231 | ||
|
|
2b0e420618 | ||
|
|
cb96735f50 | ||
|
|
fb2fd71ff4 | ||
|
|
6c2d9baeb5 | ||
|
|
cef55097ea | ||
|
|
552c82a032 | ||
|
|
2355f83295 | ||
|
|
b2fa4b3f49 | ||
|
|
d6f1f870a2 | ||
|
|
2e38300ec4 | ||
|
|
5f8530d0c0 | ||
|
|
2bd7dc68d3 | ||
|
|
173ff4f92a | ||
|
|
1f9e0d3e00 | ||
|
|
594d5ee216 | ||
|
|
2130b9715c | ||
|
|
b2ff7b5ea1 | ||
|
|
f03e0965e2 | ||
|
|
acb9380f1c | ||
|
|
40660482d4 | ||
|
|
f1cbb10edc | ||
|
|
640f001bba | ||
|
|
7b671815e0 | ||
|
|
cb1e1be0d3 | ||
|
|
78a26d61ad | ||
|
|
ff2dc246eb | ||
|
|
7e0b500d75 | ||
|
|
3670cfd966 | ||
|
|
d090788caa | ||
|
|
db4240afad | ||
|
|
34673e220d | ||
|
|
7f7fa693f3 | ||
|
|
4786ab9268 | ||
|
|
0db0ab34b4 | ||
|
|
69b65de41b | ||
|
|
0f2a1a854b | ||
|
|
32a7747440 | ||
|
|
0a8ae2934d | ||
|
|
afeabd44f0 | ||
|
|
99e234d703 | ||
|
|
117cd337dd | ||
|
|
4f5432160d | ||
|
|
92624d650f | ||
|
|
8b2f1eee13 | ||
|
|
96726c1c9b | ||
|
|
bbe270d4bf | ||
|
|
bb74a63d59 | ||
|
|
b1f3dbd45e | ||
|
|
da8bc79c6d | ||
|
|
54134e3d19 | ||
|
|
fa4c69c52f | ||
|
|
e1f57b60e3 | ||
|
|
da29ea89a7 | ||
|
|
fe672e1e4b | ||
|
|
be4960cfbb | ||
|
|
e4f7df25b0 | ||
|
|
17c45208d3 | ||
|
|
6a4f03eab3 | ||
|
|
3778d206ac | ||
|
|
f4c9da5e9f | ||
|
|
a2641b89e7 | ||
|
|
983c38a33d | ||
|
|
899f4df9ed | ||
|
|
ae0a746510 | ||
|
|
f6afc75d96 | ||
|
|
a2db2c5012 | ||
|
|
ae6e3ad5c4 | ||
|
|
e15834dae2 | ||
|
|
8a77ffe58f | ||
|
|
498ac04ad1 | ||
|
|
c77ecc15c9 | ||
|
|
2a1c6422ac | ||
|
|
4ff5f1bf1c | ||
|
|
a37035c862 | ||
|
|
cbb5ca229a | ||
|
|
954f46ec62 | ||
|
|
9798ddad80 | ||
|
|
c92bd58278 | ||
|
|
c429c421da | ||
|
|
51ccb33964 | ||
|
|
c55eabeaff | ||
|
|
a92bb8373a | ||
|
|
46304c8d98 | ||
|
|
5c93da8a72 | ||
|
|
087644a861 | ||
|
|
1b5f540d93 | ||
|
|
a0f78aad4a | ||
|
|
70cf8227a2 | ||
|
|
67fd6356aa | ||
|
|
58e61781e1 | ||
|
|
8a2e5b5962 | ||
|
|
1891e7364a | ||
|
|
ba9861f856 | ||
|
|
bc9d85b03f | ||
|
|
3e2e3b2bcb | ||
|
|
ab71e4f891 | ||
|
|
a4ec4224b0 | ||
|
|
0b77cb3a5d | ||
|
|
b4aa076a82 | ||
|
|
dc532cc2d4 | ||
|
|
3efa77a70f | ||
|
|
a8d32b71bf | ||
|
|
8074022e8f | ||
|
|
bcde526db1 | ||
|
|
23c4f78df0 | ||
|
|
148e40e07c | ||
|
|
1eae596f98 | ||
|
|
2a9456cb83 | ||
|
|
f1f9c842f8 | ||
|
|
7f243d92e5 | ||
|
|
10384e3856 | ||
|
|
8bc3608717 | ||
|
|
4b62eaeed2 | ||
|
|
c5e1b367de | ||
|
|
06b6c38379 | ||
|
|
ee0f92f6aa | ||
|
|
49d943e57f | ||
|
|
3d10d6a559 | ||
|
|
ccdaf2ffb4 | ||
|
|
c0c481a746 | ||
|
|
c2f465a98a | ||
|
|
f6fc21f5fb | ||
|
|
c3b18a1e38 | ||
|
|
11430cd555 | ||
|
|
fa8fad3b04 | ||
|
|
3ed1795096 | ||
|
|
5f0491bc6f | ||
|
|
0ff5a7bc9c | ||
|
|
34f790b85e | ||
|
|
af9c8abe9c | ||
|
|
50129ec945 | ||
|
|
2160e86928 | ||
|
|
0b2e07964f | ||
|
|
5386f00b0e | ||
|
|
78b0f14b1a | ||
|
|
467bf090dd | ||
|
|
4fcbe39fd9 | ||
|
|
7ad2de61d1 | ||
|
|
d5c95b76a5 | ||
|
|
e7d117c920 | ||
|
|
9b21aa0a60 | ||
|
|
f5a4f32b0f | ||
|
|
674aa0cf12 | ||
|
|
d1646e245a | ||
|
|
03f85bef83 | ||
|
|
d68a2cb0d8 | ||
|
|
5a1e29cc08 | ||
|
|
45b24fff0d | ||
|
|
29256aba8b | ||
|
|
4f2a47c4fc | ||
|
|
f4f2db33f0 | ||
|
|
b73014c044 | ||
|
|
53cc1667d5 | ||
|
|
af9b03e7c7 | ||
|
|
dd7c3ed2f8 | ||
|
|
7e25172f03 | ||
|
|
a83c118a8f | ||
|
|
fd9574a2f8 | ||
|
|
8014713795 | ||
|
|
10e632375f | ||
|
|
9327858bee | ||
|
|
b801a391a4 | ||
|
|
20704d6a5c | ||
|
|
1af4834f10 | ||
|
|
02f30aeee2 | ||
|
|
2f9f7d401f | ||
|
|
3686fad393 | ||
|
|
8b832f475f | ||
|
|
925bded6d9 | ||
|
|
293e0ac831 | ||
|
|
250e3555c3 | ||
|
|
8ee06f02b1 | ||
|
|
41dcd9370a | ||
|
|
c8eb666826 | ||
|
|
6f919da5d9 | ||
|
|
ff048175f7 | ||
|
|
ce7f45ab1f | ||
|
|
8befcb9477 | ||
|
|
bf9fd6a2da | ||
|
|
ab6129a1cc | ||
|
|
b0ab71db5f | ||
|
|
7f021ad5d9 | ||
|
|
3e30cde02e | ||
|
|
92858a7b47 | ||
|
|
067a9b0820 | ||
|
|
cd3df1d6e1 | ||
|
|
b632c2233b | ||
|
|
123b45aa4b | ||
|
|
87f2ec663d | ||
|
|
11f78c1913 | ||
|
|
3164b5615c | ||
|
|
56f7d31d11 | ||
|
|
d941d1efee | ||
|
|
9b1047eea7 | ||
|
|
707bffd181 | ||
|
|
c4fbdbbce4 | ||
|
|
548266d607 | ||
|
|
fb15ea20c6 | ||
|
|
c9be1cbb8b | ||
|
|
eef50058b1 | ||
|
|
c9c4ba2a72 | ||
|
|
db148c4233 | ||
|
|
c512585670 | ||
|
|
1b19fddbc6 | ||
|
|
1c3bf3bb22 | ||
|
|
176c6013ec | ||
|
|
6f28b69804 | ||
|
|
92bb9c99f5 | ||
|
|
aee1c3b069 | ||
|
|
1f4be4cfed | ||
|
|
a04ca9449a | ||
|
|
1649a9a1b1 | ||
|
|
8c4ddb99be | ||
|
|
bef5b66dab | ||
|
|
c43b5f99ac |
@@ -21,8 +21,8 @@ PHPExcel 1.7.6 LGPL 2.1 Yes Read/Write XLS files, read ODS files
|
||||
TCPDF 5.9.098 LGPL 3.0 Yes PDF generation
|
||||
|
||||
JS libraries:
|
||||
jQuery 1.7.1 GPL and MIT Licence Yes JS library
|
||||
jQuery UI 1.8.17 GPL and MIT Licence Yes JS library plugin UI
|
||||
jQuery 1.7.2 GPL and MIT Licence Yes JS library
|
||||
jQuery UI 1.8.20 GPL and MIT Licence Yes JS library plugin UI
|
||||
jQuery Colorpicker 1.1 MIT Licence Yes JS library for color picker for a defined list of colors
|
||||
jQuery DataTable 1.8.1 BSD Yes JS library for tables output
|
||||
jQuery Flot 0.7 MIT Licence Yes JS library to build graph
|
||||
@@ -51,6 +51,7 @@ Copyright (C) 2012
|
||||
- Juanjo Menent <jmenent@2byte.es>
|
||||
- Philippe Grand <philippe.grand@atoo-net.com>
|
||||
- Jean Heimburger <jean@tiaris.info>
|
||||
- Marcos García <marcosgdf@gmail.com>
|
||||
|
||||
Copyright (C) 2011
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
|
||||
55
ChangeLog
55
ChangeLog
@@ -2,7 +2,50 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 3.2.0 compared to 3.1.2 *****
|
||||
|
||||
***** ChangeLog for 3.2.2 compared to 3.2.1 *****
|
||||
|
||||
- Fix: Modify spanish VAT to new rates.
|
||||
- Fix: Add error message when creating already existing product.
|
||||
- Fix: Edition of percentage of an event.
|
||||
- Fix: Minor look fix for theme bureau2crea.
|
||||
- Fix: Start and end date not saved at project creation
|
||||
- Fix: Default vat is zero for customer invoices if company does not use vat
|
||||
- Fix: Localtaxes unit prices precision
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.2.1 compared to 3.2.0 *****
|
||||
|
||||
- Fix: Edit of projects.
|
||||
- Fix: Activation of modules does not fails if directory install was removed.
|
||||
- Fix: [ bug #444 ] Regression on auto-closing for proposals and orders.
|
||||
- Fix: Update translations (catalan, french, spanish, brazilian).
|
||||
- Fix: [ bug #445 ] Hex escaping in descriptions.
|
||||
- Fix: error when validating shipment for non predefined products with a
|
||||
selected warehouse.
|
||||
- Fix: Bad local taxes if price base type is TTC for spanish local taxes.
|
||||
- Fix: Phone not saved when using web service.
|
||||
- Fix: [ bug #464 ] Payment form should allow to add transmitter for bank transfers.
|
||||
- Fix: Allows to use a comma decimal separator in supplier invoices payments.
|
||||
- Fix: Translation for tr_TR, es_ES, pt_BR.
|
||||
- Fix: Products with no prices not visible.
|
||||
- Fix: Access to product card created with very old version of Dolibarr.
|
||||
- Fix: Delete temporary files after validating an invoice.
|
||||
- Fix: preview of supplier order and invoice template.
|
||||
- Fix: [ bug #485 ] Configurated amount for public auto-subscription form is not taken into account
|
||||
- Fix: Average amount graphs weren't comparing the previous year stats
|
||||
- Fix: Closed project didn't show the new status unless the page was refreshed
|
||||
- Fix: Files were not being uploaded to a project's task
|
||||
- Fix: [ bug #503 ] Unable to delete linked file to a deposit
|
||||
- Fix: [ bug #501 ] Error while trying to modify an user
|
||||
- Fix: [ bug #506 ] Can't set percentage of a started event
|
||||
- Fix: Bad assignation of const for pdf delivery module name
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.2.0 compared to 3.1.3 *****
|
||||
|
||||
WARNING: PHP lower than 5.x are no more supported.
|
||||
WARNING: Because of a major datastructure change onto supplier prices tables, be aware
|
||||
to make a backup of your database before making upgrade.
|
||||
@@ -99,6 +142,15 @@ WARNING: To reduce technic debt, all functions dolibarr_xxx were renamed int dol
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.1.3 compared to 3.1.2 *****
|
||||
|
||||
Fix: PgSQL - property must be set if success
|
||||
Fix: Provide a solution for backup when mysqldump is not available
|
||||
Fix: Bug #460 - Wrong entity assignment when creating a warehouse
|
||||
Fix: bug #405 - Late icon always displayed on comm/propal.php
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.1.2 compared to 3.1.1 *****
|
||||
|
||||
- Fix: Can clone a proposal
|
||||
@@ -132,6 +184,7 @@ WARNING: To reduce technic debt, all functions dolibarr_xxx were renamed int dol
|
||||
|
||||
|
||||
***** ChangeLog for 3.1 compared to 3.0 *****
|
||||
|
||||
WARNING: IE6 browser is no more supported in this version.
|
||||
For users:
|
||||
- New: War against number of clicks:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
dolibarr (3.2.0+nmu1) unstable; urgency=low
|
||||
dolibarr (3.2.3+nmu1) unstable; urgency=low
|
||||
|
||||
* Non-maintainer upload.
|
||||
* New upstream release.
|
||||
|
||||
@@ -180,11 +180,17 @@ case "$1" in
|
||||
|
||||
# Now run the drop user
|
||||
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'localhost';\"" ; then
|
||||
echo postrm Database login $dbuser removed
|
||||
echo postrm Database login $dbuser@localhost removed
|
||||
else
|
||||
error="Unable to run $mysqlcmd -f -e \"DROP USER '$dbuser'@'localhost';\""
|
||||
echo postrm $error
|
||||
fi
|
||||
if eval $mysqlcmd -f -e "\"DROP USER '$dbuser'@'%';\"" ; then
|
||||
echo postrm Database login $dbuser@% removed
|
||||
else
|
||||
error="Unable to run $mysqlcmd -f -e \"DROP USER '$dbuser'@'%';\""
|
||||
echo postrm $error
|
||||
fi
|
||||
|
||||
# Now run the drop commands
|
||||
if eval $mysqlcmd -f -e "\"show databases;\"" | grep -e "^$dbname" > /dev/null 2>&1 ; then
|
||||
|
||||
@@ -31,7 +31,7 @@ PROJECT_NAME = dolibarr
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 3.2.0
|
||||
PROJECT_NUMBER = 3.2.3
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# base path where the generated documentation will be put.
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
; ----- Change this -----
|
||||
AppName=DoliWamp
|
||||
; DoliWamp-x.x.x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
|
||||
AppVerName=DoliWamp-3.2.0
|
||||
AppVerName=DoliWamp-3.2.3
|
||||
; DoliWamp-x.x x or DoliWamp-x.x.x-alpha or DoliWamp-x.x.x-beta or DoliWamp-x.x.x-rc or DoliWamp-x.x.x
|
||||
OutputBaseFilename=DoliWamp-3.2.0
|
||||
OutputBaseFilename=DoliWamp-3.2.3
|
||||
; Define full path from wich all relative path are defined
|
||||
; You must modify this to put here your dolibarr root directory
|
||||
;SourceDir=C:\Documents and Settings\ldestail\git\dolibarr_old
|
||||
|
||||
4
build/makepack-dolibarr.pl
Normal file → Executable file
4
build/makepack-dolibarr.pl
Normal file → Executable file
@@ -10,7 +10,7 @@ use Cwd;
|
||||
$PROJECT="dolibarr";
|
||||
$MAJOR="3";
|
||||
$MINOR="2";
|
||||
$BUILD="0"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
|
||||
$BUILD="3"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
|
||||
$RPMSUBVERSION="auto"; # auto use value found into BUILD
|
||||
|
||||
@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","APS","EXEDOLIWAMP","SNAPSHOT"); # Possible packages
|
||||
@@ -412,7 +412,7 @@ if ($nboftargetok) {
|
||||
print "Go to directory $BUILDROOT\n";
|
||||
$olddir=getcwd();
|
||||
chdir("$BUILDROOT");
|
||||
$cmd= "7z a -r -tzip -xr\@\"$BUILDROOT\/$FILENAMEZIP\/build\/zip\/zip_exclude.txt\" -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMEZIP\\*";
|
||||
$cmd= "7z a -r -tzip -xr\@\"$BUILDROOT\/$FILENAMEZIP\/build\/zip\/zip_exclude.txt\" -mx $BUILDROOT/$FILENAMEZIP.zip $FILENAMEZIP\/*";
|
||||
print $cmd."\n";
|
||||
$ret= `$cmd`;
|
||||
chdir("$olddir");
|
||||
|
||||
0
build/makepack-dolibarrmodule.pl
Normal file → Executable file
0
build/makepack-dolibarrmodule.pl
Normal file → Executable file
0
build/makepack-dolibarrtheme.pl
Normal file → Executable file
0
build/makepack-dolibarrtheme.pl
Normal file → Executable file
@@ -34,7 +34,7 @@ This files describe steps made by Dolibarr packaging team to make a
|
||||
complete release of Dolibarr, step by step.
|
||||
|
||||
- Check all files are commited.
|
||||
- Update version/info in /ChangeLog and /filefunc.inc.php
|
||||
- Update version/info in /ChangeLog
|
||||
- Update version number with x.x.x-y in build/makepack-dolibarr.pl
|
||||
- Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss
|
||||
- Update version number with x.x.x-y in htdocs/filefunc.inc.php
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<CompanyName />
|
||||
<Program_Info>
|
||||
<Program_Name>DoliWamp</Program_Name>
|
||||
<Program_Version>3.2..0</Program_Version>
|
||||
<Program_Release_Month>05</Program_Release_Month>
|
||||
<Program_Version>3.2.2</Program_Version>
|
||||
<Program_Release_Month>09</Program_Release_Month>
|
||||
<Program_Release_Day>10</Program_Release_Day>
|
||||
<Program_Release_Year>2012</Program_Release_Year>
|
||||
<Program_Cost_Dollars />
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<CompanyName />
|
||||
<Program_Info>
|
||||
<Program_Name>Dolibarr</Program_Name>
|
||||
<Program_Version>3.2.0</Program_Version>
|
||||
<Program_Release_Month>05</Program_Release_Month>
|
||||
<Program_Version>3.2.2</Program_Version>
|
||||
<Program_Release_Month>09</Program_Release_Month>
|
||||
<Program_Release_Day>10</Program_Release_Day>
|
||||
<Program_Release_Year>2012</Program_Release_Year>
|
||||
<Program_Cost_Dollars />
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
</Company_Info>
|
||||
<Program_Info>
|
||||
<Program_Name>Dolibarr</Program_Name>
|
||||
<Program_Version>3.2.0</Program_Version>
|
||||
<Program_Release_Month>06</Program_Release_Month>
|
||||
<Program_Release_Day>18</Program_Release_Day>
|
||||
<Program_Version>3.2.3</Program_Version>
|
||||
<Program_Release_Month>09</Program_Release_Month>
|
||||
<Program_Release_Day>24</Program_Release_Day>
|
||||
<Program_Release_Year>2012</Program_Release_Year>
|
||||
<Program_Cost_Dollars />
|
||||
<Program_Cost_Other_Code />
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
</Company_Info>
|
||||
<Program_Info>
|
||||
<Program_Name>DoliWamp</Program_Name>
|
||||
<Program_Version>3.2.0</Program_Version>
|
||||
<Program_Release_Month>06</Program_Release_Month>
|
||||
<Program_Release_Day>18</Program_Release_Day>
|
||||
<Program_Version>3.2.3</Program_Version>
|
||||
<Program_Release_Month>09</Program_Release_Month>
|
||||
<Program_Release_Day>24</Program_Release_Day>
|
||||
<Program_Release_Year>2012</Program_Release_Year>
|
||||
<Program_Cost_Dollars />
|
||||
<Program_Cost_Other_Code />
|
||||
|
||||
@@ -30,7 +30,7 @@ return "Regis Houssin";
|
||||
# script_dolibarr_versions()
|
||||
sub script_dolibarr_versions
|
||||
{
|
||||
return ( "3.2.0", "3.1.1", "3.0.1", "2.9.0" );
|
||||
return ( "3.2.1", "3.1.1", "3.0.1", "2.9.0" );
|
||||
}
|
||||
|
||||
sub script_dolibarr_category
|
||||
@@ -362,7 +362,9 @@ sub script_dolibarr_check_latest
|
||||
{
|
||||
local ($ver) = @_;
|
||||
local @vers = &osdn_package_versions("dolibarr",
|
||||
$ver >= 3 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.2 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3.1 ? "dolibarr\\-(3\\.1\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 3 ? "dolibarr\\-(3\\.0\\.[0-9\\.]+)\\.tgz" :
|
||||
$ver >= 2.9 ? "dolibarr\\-(2\\.9\\.[0-9\\.]+)\\.tgz" :
|
||||
"dolibarr\\-(2\\.8\\.[0-9\\.]+)\\.tgz");
|
||||
return "Failed to find versions" if (!@vers);
|
||||
|
||||
@@ -312,5 +312,5 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jun 18 2012 Laurent Destailleur 3.2.0-0.3
|
||||
* Mon Sep 24 2012 Laurent Destailleur 3.2.3-0.3
|
||||
- Initial version (#723326)
|
||||
|
||||
@@ -368,5 +368,5 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jun 18 2012 Laurent Destailleur 3.2.0-0.3
|
||||
* Mon Sep 24 2012 Laurent Destailleur 3.2.3-0.3
|
||||
- Initial version (#723326)
|
||||
|
||||
@@ -301,5 +301,5 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jun 18 2012 Laurent Destailleur 3.2.0-0.3
|
||||
* Mon Sep 24 2012 Laurent Destailleur 3.2.3-0.3
|
||||
- Initial version (#723326)
|
||||
|
||||
@@ -306,5 +306,5 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jun 18 2012 Laurent Destailleur 3.2.0-0.3
|
||||
* Mon Sep 24 2012 Laurent Destailleur 3.2.3-0.3
|
||||
- Initial version (#723326)
|
||||
|
||||
@@ -1763,290 +1763,6 @@ LOCK TABLES `llx_c_ziptown` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_c_ziptown` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_cabinetmed_c_banques`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `llx_cabinetmed_c_banques`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `llx_cabinetmed_c_banques` (
|
||||
`rowid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`code` varchar(8) NOT NULL,
|
||||
`label` varchar(64) NOT NULL,
|
||||
`active` tinyint(4) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `llx_cabinetmed_c_banques`
|
||||
--
|
||||
|
||||
LOCK TABLES `llx_cabinetmed_c_banques` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_c_banques` DISABLE KEYS */;
|
||||
INSERT INTO `llx_cabinetmed_c_banques` (`rowid`, `code`, `label`, `active`) VALUES (1,'HSBC','HSBC',1);
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_c_banques` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_cabinetmed_c_examconclusion`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `llx_cabinetmed_c_examconclusion`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `llx_cabinetmed_c_examconclusion` (
|
||||
`rowid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`code` varchar(8) NOT NULL,
|
||||
`label` varchar(64) NOT NULL,
|
||||
`active` tinyint(4) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `llx_cabinetmed_c_examconclusion`
|
||||
--
|
||||
|
||||
LOCK TABLES `llx_cabinetmed_c_examconclusion` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_c_examconclusion` DISABLE KEYS */;
|
||||
INSERT INTO `llx_cabinetmed_c_examconclusion` (`rowid`, `code`, `label`, `active`) VALUES (1,'AUTRE','Autre',1);
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_c_examconclusion` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_cabinetmed_cons`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `llx_cabinetmed_cons`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `llx_cabinetmed_cons` (
|
||||
`rowid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`fk_soc` int(11) DEFAULT NULL,
|
||||
`fk_user_creation` int(11) NOT NULL,
|
||||
`datecons` date NOT NULL,
|
||||
`typepriseencharge` varchar(8) DEFAULT NULL,
|
||||
`motifconsprinc` varchar(64) DEFAULT NULL,
|
||||
`diaglesprinc` varchar(64) DEFAULT NULL,
|
||||
`motifconssec` text,
|
||||
`diaglessec` text,
|
||||
`hdm` text,
|
||||
`examenclinique` text,
|
||||
`examenprescrit` text,
|
||||
`traitementprescrit` text,
|
||||
`comment` text,
|
||||
`typevisit` varchar(8) NOT NULL,
|
||||
`infiltration` varchar(256) DEFAULT NULL,
|
||||
`codageccam` varchar(16) DEFAULT NULL,
|
||||
`montant_cheque` double(24,8) DEFAULT NULL,
|
||||
`montant_espece` double(24,8) DEFAULT NULL,
|
||||
`montant_carte` double(24,8) DEFAULT NULL,
|
||||
`montant_tiers` double(24,8) DEFAULT NULL,
|
||||
`banque` varchar(128) DEFAULT NULL,
|
||||
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`rowid`),
|
||||
KEY `idx_cabinetmed_cons_fk_soc` (`fk_soc`),
|
||||
KEY `idx_cabinetmed_cons_datecons` (`datecons`),
|
||||
CONSTRAINT `fk_cabinetmed_cons_fk_soc` FOREIGN KEY (`fk_soc`) REFERENCES `llx_societe` (`rowid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `llx_cabinetmed_cons`
|
||||
--
|
||||
|
||||
LOCK TABLES `llx_cabinetmed_cons` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_cons` DISABLE KEYS */;
|
||||
INSERT INTO `llx_cabinetmed_cons` (`rowid`, `fk_soc`, `fk_user_creation`, `datecons`, `typepriseencharge`, `motifconsprinc`, `diaglesprinc`, `motifconssec`, `diaglessec`, `hdm`, `examenclinique`, `examenprescrit`, `traitementprescrit`, `comment`, `typevisit`, `infiltration`, `codageccam`, `montant_cheque`, `montant_espece`, `montant_carte`, `montant_tiers`, `banque`, `tms`) VALUES (2,2,1,'2011-04-17',NULL,'Cervicalgies Inflammatoires','Arthrite Microcristalline','','','','rrrr','','','','CS','','',NULL,55.00000000,NULL,NULL,'','2011-05-25 13:59:03'),(3,2,1,'2011-05-01',NULL,'Cervicalgies Mécaniques','Arthrite Goutteuse','yyyykk\r\nDorsalgie\r\nDorsalgies Inflammatoires\r\nDouleur Chevillep\r\nDouleur Genou\r\nDouleur Genou','','lll','','','','','CS','','',NULL,NULL,NULL,50.00000000,'','2011-05-25 13:59:03'),(4,4,1,'2011-05-02',NULL,'Autre','Arthrite Goutteuse','','','','','','','','CCAM','inf','ccam',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-25 13:59:03'),(5,5,1,'2011-05-02',NULL,'Cervicalgies Inflammatoires','Arthrite Microcristalline','','dgdfg','','','','','','CCAM','ingg','pp',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-28 15:22:22'),(6,5,1,'2011-05-02',NULL,'Cervicalgies Inflammatoires','Arthrose FémoroPatellaire','','','','','','kk','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-25 13:59:03'),(7,4,1,'2011-05-03',NULL,'Cervicalgies Mécaniques','Arthrite Goutteuse','Douleur Cheville','Arthrite Microcristalline','fd','fd','Bilan Phosphocalcique','fdf','fdfd','CCAM','lllll','kkk',NULL,NULL,NULL,0.00000000,'','2011-06-14 23:13:42'),(8,5,1,'2011-05-03',NULL,'Cervicalgies Mécaniques','gggg','','','pppljklj','','','','','CS','kmlkmlkml mlmlkmkm mk ml mlk','',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-28 15:00:27'),(10,3,1,'2011-05-07',NULL,'dfgdf','gfdgd','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-25 13:59:03'),(11,9,1,'2011-05-25',NULL,'Dérobement Membres Inférieurs','Arthrite Goutteuse','Dorsalgie\r\nDorsalgies Mécaniques','Lomboradiculalgie Discale\r\nLombosciatique L5 gauche','','','ArthroScanner Genou\r\nIRM Genou\r\nIRM Rachis Lombaire','1\r\n2\r\n3\r\n4\r\n5\r\n6','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-05-28 15:58:29'),(12,32,1,'2011-06-08',NULL,'Cervicalgies Inflammatoires','Arthrite Goutteuse','','','','','','','','CS','','',NULL,NULL,NULL,50.00000000,'','2011-06-08 14:38:10'),(13,26,1,'2011-06-13',NULL,'Cervicalgies Mécaniques','Arthrite Microcristalline','','','','','ArthroScanner Hanche','Traitement prescrit.','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-06-13 15:25:39'),(14,26,1,'2011-06-13',NULL,'Douleur Membre inférieur Gauche','Lombosciatique L5 gauche','','Lombalgie Discale','','','','AINS (biprohénide), murolaxan\r\ndoliprane\r\n+ rééduction','','CCAM','infiltr épidurale','AHLB001',90.00000000,NULL,NULL,NULL,'HSBC','2011-06-13 16:16:43'),(15,1,1,'2011-06-13',NULL,'Cervicalgies Mécaniques','Arthrite Microcristalline','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-06-13 18:07:26'),(16,36,1,'2011-06-15',NULL,'gdfgfd','gdfgdfgdf','','','','','ArthroScanner Epaule','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-06-15 00:28:43'),(17,36,1,'2011-06-15',NULL,'hfghfg','hgfhfghf','','','','','','','','CS','','',NULL,10.00000000,NULL,NULL,'','2011-06-15 00:31:57'),(18,65,1,'2011-07-06',NULL,'Cervicalgies Inflammatoires','aaaaa','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-07-06 20:17:20'),(19,67,1,'2011-07-11',NULL,'Cervicalgies Inflammatoires','Canal Carpien','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-07-10 21:23:30'),(20,68,1,'2011-07-13',NULL,'Cervicalgies Mécaniques','Autre','','','','','','','','CS','','',50.00000000,NULL,NULL,NULL,'HSBC','2011-07-13 16:26:21'),(21,68,1,'2011-07-13',NULL,'aaaa','bbbb','','','','','','','','CS','','',NULL,NULL,50.00000000,NULL,'','2011-07-13 18:18:29'),(22,68,1,'2011-07-13',NULL,'lll','llll','','','','','','','','CS','','',NULL,NULL,10.00000000,NULL,'','2011-07-13 18:21:57'),(23,68,1,'2011-07-13',NULL,'oo','oo','','','','','','','','CS','','',NULL,NULL,NULL,5.00000000,'','2011-07-13 18:26:18');
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_cons` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_cabinetmed_diaglec`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `llx_cabinetmed_diaglec`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `llx_cabinetmed_diaglec` (
|
||||
`rowid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`code` varchar(8) NOT NULL,
|
||||
`label` varchar(64) NOT NULL,
|
||||
`active` tinyint(4) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `llx_cabinetmed_diaglec`
|
||||
--
|
||||
|
||||
LOCK TABLES `llx_cabinetmed_diaglec` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_diaglec` DISABLE KEYS */;
|
||||
INSERT INTO `llx_cabinetmed_diaglec` (`rowid`, `code`, `label`, `active`) VALUES (1,'AUTRE','Autre',1),(2,'LOMBL5D','Lombosciatique L5 droite',1),(3,'LOMBL5G','Lombosciatique L5 gauche',1),(4,'LOMBS1D','Lombosciatique S1 droite',1),(5,'LOMBS1G','Lombosciatique S1 gauche',1),(6,'NCB','Névralgie cervico-brachiale',1),(7,'PR','Polyarthrite rhumatoide',1),(8,'SA','Spondylarthrite ankylosante',1),(9,'GFTI','Gonarthrose fémoro-tibaile interne',1),(10,'GFTE','Gonarthrose fémoro-tibiale externe',1),(11,'COX','Coxarthrose',1),(12,'CC','Canal Carpien',1),(16,'CLER','Canal Lombaire Etroit et/ou Rétréci',1),(22,'RH PSO','Rhumatisme Psoriasique',1),(23,'LEAD','Lupus',1),(24,'LBDISC','Lombalgie Discale',1),(25,'LBRADD','Lomboradiculalgie Discale',1),(26,'LBRADND','Lomboradiculalgie Non Discale',1),(27,'CH ROT','Chondropathie Rotulienne',1),(28,'AFP','Arthrose FémoroPatellaire',1),(29,'PPR','Pseudo Polyarthrite Rhizomélique',1),(30,'SHARP','Maladie de Sharp',1),(31,'SAPHO','SAPHO',1),(32,'OMARTHC','Omarthrose Centrée',1),(33,'RH CCA','Rhumatisme Chondro Calcinosique',1),(34,'GOUTTE','Arthrite Goutteuse',1),(35,'CCA','Arthrite Chondro Calcinosique',1),(36,'ARTH MCR','Arthrite Microcristalline',1),(37,'CSA','Conflit Sous Acromial',1),(38,'TDCALCE','Tendinopathie Calcifiante d\'Epaule',1),(39,'TDCALCH','Tendinopathie Calcifiante de Hanche',1),(40,'TBT','TendinoBursite Trochantérienne',1),(41,'OMARTHE','Omarthrose Excentrée',1);
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_diaglec` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_cabinetmed_examaut`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `llx_cabinetmed_examaut`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `llx_cabinetmed_examaut` (
|
||||
`rowid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`fk_soc` int(11) DEFAULT NULL,
|
||||
`dateexam` date NOT NULL,
|
||||
`examprinc` varchar(64) DEFAULT NULL,
|
||||
`examsec` text,
|
||||
`concprinc` varchar(64) DEFAULT NULL,
|
||||
`concsec` text,
|
||||
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `llx_cabinetmed_examaut`
|
||||
--
|
||||
|
||||
LOCK TABLES `llx_cabinetmed_examaut` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_examaut` DISABLE KEYS */;
|
||||
INSERT INTO `llx_cabinetmed_examaut` (`rowid`, `fk_soc`, `dateexam`, `examprinc`, `examsec`, `concprinc`, `concsec`, `tms`) VALUES (1,2,'2011-05-08','ArthroScanner Genou','ArthroScanner EpauleeeeArthroScanner HancheIRM EpauleggggBilan Radio ScolioseuuuuqqqqlIRM Rachis Cervical','Autre','','2011-05-01 14:47:57'),(2,2,'2011-05-02','dd','ArthroScanner Hanche\r\nBilan Radio Scoliose\r\neeee\r\nElectromiogramme','dd','','2011-05-01 23:49:59'),(3,32,'2011-06-08','ArthroScanner Genou','gdfgdfgdfgdfgdfgdfgd','Autre','','2011-06-08 14:54:45'),(4,32,'2011-06-08','IRM SacroIliaques','','fsdfsdfsdfsd','','2011-06-08 14:57:01'),(5,26,'2011-06-13','Bilan Radio Rhumatisme Inflammatoire','','Autre','','2011-06-13 15:27:39'),(6,26,'2011-06-13','ArthroScanner Genou','Autre','Autre','','2011-06-13 15:29:31'),(7,26,'2011-06-13','Scanner Lombaire','','Hernie discale L4-L5 gauche','','2011-06-13 16:20:47'),(8,65,'2011-07-06','ArthroScanner Hanche','','Autre','','2011-07-06 20:17:54');
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_examaut` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_cabinetmed_exambio`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `llx_cabinetmed_exambio`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `llx_cabinetmed_exambio` (
|
||||
`rowid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`fk_soc` int(11) DEFAULT NULL,
|
||||
`dateexam` date NOT NULL,
|
||||
`resultat` text,
|
||||
`conclusion` text,
|
||||
`comment` text,
|
||||
`suivipr_ad` int(11) DEFAULT NULL,
|
||||
`suivipr_ag` int(11) DEFAULT NULL,
|
||||
`suivipr_vs` int(11) DEFAULT NULL,
|
||||
`suivipr_eva` int(11) DEFAULT NULL,
|
||||
`suivipr_err` int(11) DEFAULT NULL,
|
||||
`suivisa_fat` int(11) DEFAULT NULL,
|
||||
`suivisa_dax` int(11) DEFAULT NULL,
|
||||
`suivisa_dpe` int(11) DEFAULT NULL,
|
||||
`suivisa_dpa` int(11) DEFAULT NULL,
|
||||
`suivisa_rno` int(11) DEFAULT NULL,
|
||||
`suivisa_dma` int(11) DEFAULT NULL,
|
||||
`suivisa_basdai` double DEFAULT NULL,
|
||||
`tms` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`suivisa_das28` double DEFAULT NULL,
|
||||
`suivipr_das28` double DEFAULT NULL,
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `llx_cabinetmed_exambio`
|
||||
--
|
||||
|
||||
LOCK TABLES `llx_cabinetmed_exambio` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_exambio` DISABLE KEYS */;
|
||||
INSERT INTO `llx_cabinetmed_exambio` (`rowid`, `fk_soc`, `dateexam`, `resultat`, `conclusion`, `comment`, `suivipr_ad`, `suivipr_ag`, `suivipr_vs`, `suivipr_eva`, `suivipr_err`, `suivisa_fat`, `suivisa_dax`, `suivisa_dpe`, `suivisa_dpa`, `suivisa_rno`, `suivisa_dma`, `suivisa_basdai`, `tms`, `suivisa_das28`, `suivipr_das28`) VALUES (1,2,'2011-05-01','aaajhkh','bbb','ccc',NULL,NULL,NULL,NULL,NULL,1,2,3,4,5,6,NULL,'2011-05-01 14:45:54',NULL,NULL),(3,2,'2011-05-01','dd','hfghfg','',1,2,6,9,NULL,2,2,2,2,2,2,NULL,'2011-05-01 15:24:06',NULL,NULL),(4,2,'2011-05-01','gdfgdf','1111','',NULL,NULL,NULL,NULL,NULL,1,7,8,9,10,11,NULL,'2011-05-01 15:25:17',NULL,NULL),(5,2,'2011-05-01','fdsfsdfsdfsd','ccccc','fsdfsdfs',1,2,4,3,NULL,1,2,3,4,5,6,NULL,'2011-05-01 16:37:51',NULL,NULL),(6,2,'2011-05-01','gfdgdfgdf','gdfgdf','',5,NULL,NULL,NULL,NULL,1,NULL,1,1,NULL,NULL,NULL,'2011-05-01 16:43:49',NULL,NULL),(8,1,'2011-05-01','lkjljkl','','',1,2,4,3,NULL,5,10,5,6,5,5,6.2,'2011-05-01 16:46:00',NULL,1.97),(9,32,'2011-06-08','retert','trete','',1,2,4,1,NULL,2,5,2,5,4,6,NULL,'2011-06-08 14:47:30',NULL,NULL),(10,32,'2011-06-08','fgdfgdfg','gfgdfgdf','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-08 14:54:23',NULL,NULL),(11,26,'2011-06-13','result bio 1','conclusion bio 1','',1,2,4,4,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-13 15:27:15',NULL,NULL),(12,26,'2011-06-13','result bio 2','','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-13 15:27:25',NULL,NULL),(13,26,'2011-06-13','VS8\r\nCRP inférieur ) 5','Pas de syndrome inflammatoire.','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-13 16:19:08',NULL,NULL),(14,26,'2011-06-13','','','',NULL,NULL,NULL,NULL,NULL,1,2,2,4,5,6,NULL,'2011-06-13 16:19:38',NULL,NULL),(15,26,'2011-06-13','','','',1,2,4,3,NULL,1,2,3,4,5,6,0.31,'2011-06-13 17:50:25',NULL,1.97),(16,36,'2011-06-15','gdfgddfhghghhfghf','','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-06-15 08:02:03',NULL,NULL),(17,65,'2011-07-06','hfghfghgf','Zob','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-07-06 20:17:33',NULL,NULL),(18,67,'2011-07-11','gfdg','gfdg','gfd',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-07-10 22:23:21',NULL,NULL),(19,62,'2011-07-13','dfgdf','gdfd','',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2011-07-13 15:56:27',NULL,NULL);
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_exambio` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_cabinetmed_examenprescrit`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `llx_cabinetmed_examenprescrit`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `llx_cabinetmed_examenprescrit` (
|
||||
`rowid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`code` varchar(8) NOT NULL,
|
||||
`label` varchar(64) NOT NULL,
|
||||
`biorad` varchar(8) NOT NULL,
|
||||
`active` tinyint(4) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `llx_cabinetmed_examenprescrit`
|
||||
--
|
||||
|
||||
LOCK TABLES `llx_cabinetmed_examenprescrit` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_examenprescrit` DISABLE KEYS */;
|
||||
INSERT INTO `llx_cabinetmed_examenprescrit` (`rowid`, `code`, `label`, `biorad`, `active`) VALUES (1,'AUTRE','Autre','AUTRE',1),(2,'IRMLOMB','IRM lombaire','RADIO',1),(5,'TDMLOMB','TDM lombaires','RADIO',1),(6,'RX BRL','Radios Bassin-Rachis Lombaire','RADIO',1),(7,'RX RL','Radios Rachis Lombaire','RADIO',1),(8,'RX BASS','Radios Bassin','RADIO',1),(9,'RX BH','Radios Bassin et Hanches','RADIO',1),(10,'RX GEN','Radios Genoux','RADIO',1),(11,'RX CHEV','Radios Chevilles','RADIO',1),(12,'RX AVPD','Radios Avants-Pieds','RADIO',1),(13,'RX EP','Radio Epaule','RADIO',1),(14,'RX MAINS','Radios Mains','RADIO',1),(15,'RX COUDE','Radios Coude','RADIO',1),(16,'RX RC','Radios Rachis Cervical','RADIO',1),(17,'RX RD','Radios Rachis Dorsal','RADIO',1),(18,'RX RCD','Radios Rachis CervicoDorsal','RADIO',1),(19,'RX RDL','Radios DorsoLombaire','RADIO',1),(20,'RX SCO','Bilan Radio Scoliose','RADIO',1),(21,'RX RIC','Bilan Radio Rhumatisme Inflammatoire','RADIO',1),(22,'TDM LOMB','Scanner Lombaire','RADIO',1),(23,'TDM DORS','Scanner Dorsal','RADIO',1),(24,'TDM CERV','Scanner Cervical','RADIO',1),(25,'TDM HANC','Scanner Hanche','RADIO',1),(26,'TDM GEN','Scanner Genou','RADIO',1),(27,'RX RDL','Radios Rachis DorsoLombaire','RADIO',1),(28,'ARTTDMG','ArthroScanner Genou','RADIO',1),(29,'ARTTDME','ArthroScanner Epaule','RADIO',1),(30,'ARTTDMH','ArthroScanner Hanche','RADIO',1),(31,'IRM GEN','IRM Genou','RADIO',1),(32,'IRM HANC','IRM Hanche','RADIO',1),(33,'IRM EP','IRM Epaule','RADIO',1),(34,'IRM SIL','IRM SacroIliaques','RADIO',1),(35,'IRM RL','IRM Rachis Lombaire','RADIO',1),(36,'IRM RD','IRM Rachis Dorsal','RADIO',1),(37,'IRM RC','IRM Rachis Cervical','RADIO',1),(38,'ELECMI','Electromiogramme','RADIO',1),(39,'NFS','NFS','BIO',1),(40,'BILPHO','Bilan Phosphocalcique','BIO',1),(41,'VSCRP','VS/CRP','BIO',1),(42,'EPP','Electrophorèse Protéine Plasmatique','BIO',1);
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_examenprescrit` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_cabinetmed_motifcons`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `llx_cabinetmed_motifcons`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `llx_cabinetmed_motifcons` (
|
||||
`rowid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`code` varchar(8) NOT NULL,
|
||||
`label` varchar(64) NOT NULL,
|
||||
`active` tinyint(4) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `llx_cabinetmed_motifcons`
|
||||
--
|
||||
|
||||
LOCK TABLES `llx_cabinetmed_motifcons` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_motifcons` DISABLE KEYS */;
|
||||
INSERT INTO `llx_cabinetmed_motifcons` (`rowid`, `code`, `label`, `active`) VALUES (5,'AUTRE','Autre',1),(6,'DORS','Dorsalgie',1),(7,'DOLMSD','Douleur Membre supérieur Droit',1),(8,'DOLMSG','Douleur Membre supérieur Gauche',1),(9,'DOLMID','Douleur Membre inférieur Droit',1),(10,'DOLMIG','Douleur Membre inférieur Gauche',1),(11,'PARESM','Paresthésie des mains',1),(12,'DOLEPG','Douleur épaule gauche',1),(13,'DOLEPD','Douleur épaule droite',1),(14,'GONAD','Gonaglie droite',1),(15,'GONAG','Gonalgie gauche',1),(16,'DOLPD','Douleur Pied Droit',1),(17,'DOUL MIN','Douleur Membre Inférieur',1),(18,'POLYAR','Polyarthralgie',1),(19,'SUIVIPR','Suivi PR',1),(20,'SUIVISPA','Suivi SPA',1),(21,'SUIVIRIC','Suivi RI',1),(22,'SUIVIPPR','Suivi PPR',1),(23,'DOLINGD','Douleur inguinale Droit',1),(24,'DOLINGG','Douleur inguinale Gauche',1),(25,'DOLCOUDD','Douleur coude Droit',1),(26,'DOLCOUDG','Douleur coude Gauche',1),(27,'TALAL','Talalgie',1),(28,'DOLTENDC','Douleur tandous Calcanien',1),(29,'DEROB','Dérobement Membres Inférieurs',1),(30,'LOMB MEC','Lombalgies Mécaniques',1),(31,'LOMB INF','Lombalgies Inflammatoires',1),(32,'DORS MEC','Dorsalgies Mécaniques',1),(33,'DORS INF','Dorsalgies Inflammatoires',1),(34,'CERV MEC','Cervicalgies Mécaniques',1),(35,'SCIAT','LomboSciatique ',1),(36,'CRUR','LomboCruralgie',1),(37,'DOUL SUP','Douleur Membre Supérieur',1),(38,'INGUINAL','Inguinalgie',1),(39,'CERV INF','Cervicalgies Inflammatoires',1),(40,'DOUL EP','Douleur Epaule',1),(41,'DOUL POI','Douleur Poignet',1),(42,'DOUL GEN','Douleur Genou',1),(43,'DOUL COU','Douleur Coude',1),(44,'DOUL HAN','Douleur Hanche',1),(45,'PAR MBRS','Paresthésies Membres Inférieurs',1),(46,'PAR MBRI','Paresthésies Membres Supérieurs',1),(47,'TR RACHI','Traumatisme Rachis',1),(48,'TR MBRS','Traumatisme Membres Supérieurs',1),(49,'TR MBRI','Traumatisme Membres Inférieurs',1),(50,'FAT MBRI','Fatiguabilité Membres Inférieurs',1),(51,'DOUL CHE','Douleur Cheville',1),(52,'DOUL PD','Douleur Pied',1),(53,'DOUL MA','Douleur Main',1);
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_motifcons` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_cabinetmed_patient`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `llx_cabinetmed_patient`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `llx_cabinetmed_patient` (
|
||||
`rowid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`note_antemed` text,
|
||||
`note_antechirgen` text,
|
||||
`note_antechirortho` text,
|
||||
`note_anterhum` text,
|
||||
`note_other` text,
|
||||
`note_traitclass` text,
|
||||
`note_traitallergie` text,
|
||||
`note_traitintol` text,
|
||||
`note_traitspec` text,
|
||||
PRIMARY KEY (`rowid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=47 DEFAULT CHARSET=utf8;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `llx_cabinetmed_patient`
|
||||
--
|
||||
|
||||
LOCK TABLES `llx_cabinetmed_patient` WRITE;
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_patient` DISABLE KEYS */;
|
||||
INSERT INTO `llx_cabinetmed_patient` (`rowid`, `note_antemed`, `note_antechirgen`, `note_antechirortho`, `note_anterhum`, `note_other`, `note_traitclass`, `note_traitallergie`, `note_traitintol`, `note_traitspec`) VALUES (2,'fffgfgfgf','','','','jjj','aaaagggggggg','','',''),(5,'a','b','c','d','','','','i','u'),(8,NULL,NULL,NULL,NULL,NULL,'','','','tr<span style=\"color: rgb(178, 34, 34);\"><strong>e tre tert</strong></span>er<br />\r\nt<br />\r\nter tert'),(26,NULL,NULL,NULL,NULL,NULL,'','','intol','spec pharma'),(46,'hfhf','dddd','','hfghfg','',NULL,'',NULL,NULL);
|
||||
/*!40000 ALTER TABLE `llx_cabinetmed_patient` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `llx_categorie`
|
||||
--
|
||||
|
||||
@@ -135,7 +135,7 @@ if ($conf->global->ADHERENT_USE_MAILMAN)
|
||||
'ADHERENT_MAILMAN_LISTS'
|
||||
);
|
||||
|
||||
print_fiche_titre("Mailman mailing list system",$lien,'');
|
||||
print_fiche_titre($langs->trans('MailmanTitle'),$lien,'');
|
||||
|
||||
// JQuery activity
|
||||
print '<script type="text/javascript">
|
||||
|
||||
@@ -400,12 +400,16 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
|
||||
if (! $error)
|
||||
{
|
||||
$bank_line_id=$paiement->addPaymentToBank($user,'payment','(SubscriptionPayment)',$accountid,$emetteur_nom,$emetteur_banque);
|
||||
if (! $bank_line_id > 0)
|
||||
if (! ($bank_line_id > 0))
|
||||
{
|
||||
$errmsg=$paiement->error;
|
||||
$errmsgs=$paiement->errors;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Update fk_bank for subscriptions
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'cotisation SET fk_bank='.$bank_line_id;
|
||||
$sql.= ' WHERE rowid='.$crowid;
|
||||
|
||||
@@ -708,36 +708,43 @@ class Adherent extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->affected_rows($resql))
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rien a effacer
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
// Remove linked user
|
||||
$ret=$this->setUserId(0);
|
||||
if ($ret > 0)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->affected_rows($resql))
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('MEMBER_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Rien a effacer
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -39,7 +39,13 @@ $langs->load('other');
|
||||
$id=GETPOST('id','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$mesg = "";
|
||||
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
@@ -114,7 +120,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
$langs->load("other");
|
||||
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
dol_delete_file($file);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ $var=true;
|
||||
*/
|
||||
$max=5;
|
||||
|
||||
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
|
||||
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
|
||||
$sql.= " a.tms as datem, datefin as date_end_subscription,";
|
||||
$sql.= " ta.rowid as typeid, ta.libelle, ta.cotisation";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||
@@ -242,12 +242,19 @@ if ($resql)
|
||||
$staticmember->id=$obj->rowid;
|
||||
$staticmember->lastname=$obj->lastname;
|
||||
$staticmember->firstname=$obj->firstname;
|
||||
if (! empty($obj->fk_soc)) {
|
||||
$staticmember->socid = $obj->fk_soc;
|
||||
$staticmember->fetch_thirdparty();
|
||||
$staticmember->name=$staticmember->thirdparty->name;
|
||||
} else {
|
||||
$staticmember->name=$obj->company;
|
||||
}
|
||||
$staticmember->ref=$staticmember->getFullName($langs);
|
||||
$statictype->id=$obj->typeid;
|
||||
$statictype->libelle=$obj->libelle;
|
||||
print '<td>'.$staticmember->getNomUrl(1,24).'</td>';
|
||||
print '<td>'.$statictype->getNomUrl(1,16).'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->date_end),'dayhour').'</td>';
|
||||
print '<td>'.$staticmember->getNomUrl(1,32).'</td>';
|
||||
print '<td>'.$statictype->getNomUrl(1,32).'</td>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datem),'dayhour').'</td>';
|
||||
print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
@@ -266,7 +273,7 @@ else
|
||||
*/
|
||||
$max=5;
|
||||
|
||||
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname,";
|
||||
$sql = "SELECT a.rowid, a.statut, a.nom as lastname, a.prenom as firstname, a.societe as company, a.fk_soc,";
|
||||
$sql.= " datefin as date_end_subscription,";
|
||||
$sql.= " c.rowid as cid, c.tms as datem, c.datec as datec, c.dateadh as date_start, c.datef as date_end, c.cotisation";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."cotisation as c";
|
||||
@@ -297,9 +304,16 @@ if ($resql)
|
||||
$staticmember->id=$obj->rowid;
|
||||
$staticmember->lastname=$obj->lastname;
|
||||
$staticmember->firstname=$obj->firstname;
|
||||
if (! empty($obj->fk_soc)) {
|
||||
$staticmember->socid = $obj->fk_soc;
|
||||
$staticmember->fetch_thirdparty();
|
||||
$staticmember->name=$staticmember->thirdparty->name;
|
||||
} else {
|
||||
$staticmember->name=$obj->company;
|
||||
}
|
||||
$staticmember->ref=$staticmember->getFullName($langs);
|
||||
print '<td>'.$subscriptionstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$staticmember->getNomUrl(1,24,'subscription').'</td>';
|
||||
print '<td>'.$staticmember->getNomUrl(1,32,'subscription').'</td>';
|
||||
print '<td>'.get_date_range($db->jdate($obj->date_start),$db->jdate($obj->date_end)).'</td>';
|
||||
print '<td align="right">'.price($obj->cotisation).'</td>';
|
||||
//print '<td align="right">'.$staticmember->LibStatut($obj->statut,($obj->cotisation=='yes'?1:0),$db->jdate($obj->date_end_subscription),5).'</td>';
|
||||
@@ -330,7 +344,7 @@ foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="type.php?rowid='.$adhtype->id.'">'.img_object($langs->trans("ShowType"),"group").' '.$adhtype->getNomUrl(0,dol_size(16)).'</a></td>';
|
||||
print '<td>'.$adhtype->getNomUrl(1, dol_size(32)).'</td>';
|
||||
print '<td align="right">'.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->cotisation,0,3).'</td>';
|
||||
print '<td align="right">'.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-$MemberUpToDate[$key] > 0) ? $MembersValidated[$key]-$MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,0,3).'</td>';
|
||||
print '<td align="right">'.(isset($MemberUpToDate[$key]) && $MemberUpToDate[$key] > 0 ? $MemberUpToDate[$key]:'').' '.$staticmember->LibStatut(1,$adhtype->cotisation,$now,3).'</td>';
|
||||
|
||||
@@ -82,7 +82,7 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhé
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe, ";
|
||||
$sql = "SELECT d.rowid, d.login, d.nom as lastname, d.prenom as firstname, d.societe as company, d.fk_soc,";
|
||||
$sql.= " d.datefin,";
|
||||
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
|
||||
$sql.= " t.libelle as type, t.cotisation";
|
||||
@@ -130,7 +130,7 @@ if ($filter == 'uptodate')
|
||||
}
|
||||
if ($filter == 'outofdate')
|
||||
{
|
||||
$sql.=" AND datefin < '".$db->idate($now)."'";
|
||||
$sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
|
||||
}
|
||||
// Insert categ filter
|
||||
if ($search_categ)
|
||||
@@ -237,7 +237,7 @@ if ($resql)
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
$listetype=$membertypestatic->liste_array();
|
||||
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 12);
|
||||
print $form->selectarray("type", $listetype, $type, 1, 0, 0, '', 0, 32);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre"> </td>';
|
||||
@@ -267,6 +267,14 @@ if ($resql)
|
||||
$memberstatic->lastname=$objp->lastname;
|
||||
$memberstatic->firstname=$objp->firstname;
|
||||
|
||||
if (! empty($objp->fk_soc)) {
|
||||
$memberstatic->socid = $objp->fk_soc;
|
||||
$memberstatic->fetch_thirdparty();
|
||||
$companyname=$memberstatic->thirdparty->name;
|
||||
} else {
|
||||
$companyname=$objp->company;
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
@@ -276,14 +284,11 @@ if ($resql)
|
||||
print "</td>\n";
|
||||
|
||||
// Lastname
|
||||
if ($objp->societe != '')
|
||||
{
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))." / ".dol_trunc($objp->societe,12)."</a></td>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">".dol_trunc($memberstatic->getFullName($langs))."</a></td>\n";
|
||||
}
|
||||
print "<td><a href=\"fiche.php?rowid=$objp->rowid\">";
|
||||
print ((! empty($objp->lastname) || ! empty($objp->firstname)) ? dol_trunc($memberstatic->getFullName($langs)) : '');
|
||||
print (((! empty($objp->lastname) || ! empty($objp->firstname)) && ! empty($companyname)) ? ' / ' : '');
|
||||
print (! empty($companyname) ? dol_trunc($companyname, 32) : '');
|
||||
print "</a></td>\n";
|
||||
|
||||
// Login
|
||||
print "<td>".$objp->login."</td>\n";
|
||||
@@ -292,7 +297,7 @@ if ($resql)
|
||||
$membertypestatic->id=$objp->type_id;
|
||||
$membertypestatic->libelle=$objp->type;
|
||||
print '<td nowrap="nowrap">';
|
||||
print $membertypestatic->getNomUrl(1,12);
|
||||
print $membertypestatic->getNomUrl(1,32);
|
||||
print '</td>';
|
||||
|
||||
// Moral/Physique
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -112,7 +112,7 @@ $dirbarcode=array_merge(array("/core/modules/barcode/"),$conf->barcode_modules);
|
||||
|
||||
foreach($dirbarcode as $reldir)
|
||||
{
|
||||
$dir=dol_buildpath($reldir,0);
|
||||
$dir=dol_buildpath($reldir);
|
||||
$newdir=dol_osencode($dir);
|
||||
|
||||
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
|
||||
@@ -334,4 +334,4 @@ dol_htmloutput_mesg($mesg);
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -759,7 +759,7 @@ else
|
||||
// Forme juridique
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("JuridicalStatus").'</td><td>';
|
||||
print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE,1);
|
||||
print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
|
||||
print '</td></tr>';
|
||||
|
||||
// ProfId1
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstorder=GETPOST('maskconstorder','alpha');
|
||||
$maskorder=GETPOST('maskorder','alpha');
|
||||
|
||||
|
||||
if ($maskconstorder) $res = dolibarr_set_const($db,$maskconstorder,$maskorder,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
@@ -76,7 +76,7 @@ if ($action == 'specimen') // For orders
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->initAsSpecimen();
|
||||
$commande->thirdparty=$specimenthirdparty;
|
||||
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
@@ -90,13 +90,13 @@ if ($action == 'specimen') // For orders
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once($file);
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
|
||||
$module = new $classname($db,$commande);
|
||||
|
||||
if ($module->write_file($commande,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
|
||||
@@ -122,7 +122,7 @@ if ($action == 'specimenfacture') // For invoices
|
||||
$facture = new FactureFournisseur($db);
|
||||
$facture->initAsSpecimen();
|
||||
$facture->thirdparty=$specimenthirdparty; // Define who should has build the invoice (so the supplier)
|
||||
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
@@ -136,13 +136,13 @@ if ($action == 'specimenfacture') // For invoices
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once($file);
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
|
||||
$module = new $classname($db,$facture);
|
||||
|
||||
if ($module->write_file($facture,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");
|
||||
@@ -165,7 +165,7 @@ if ($action == 'set')
|
||||
{
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
|
||||
$sql.= " VALUES ('".$db->escape($value)."','".$type."',".$conf->entity.", ";
|
||||
$sql.= ($label?"'".$db->escape($label)."'":'null').", ";
|
||||
@@ -197,7 +197,7 @@ if ($action == 'setdoc')
|
||||
{
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
if ($type == 'order_supplier' && dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
|
||||
@@ -101,6 +101,9 @@ print "<br>\n";
|
||||
|
||||
if ($action == 'edit') // Edit
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
@@ -132,12 +135,10 @@ if ($action == 'edit') // Edit
|
||||
|
||||
print '</table><br>'."\n";
|
||||
|
||||
|
||||
// Themes
|
||||
show_theme('',1);
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Liste des zone de recherche permanantes supportees
|
||||
print '<table summary="search" class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="35%">'.$langs->trans("PermanentLeftSearchForm").'</td><td colspan="2">'.$langs->trans("Activated").'</td></tr>';
|
||||
@@ -227,18 +228,19 @@ if ($action == 'edit') // Edit
|
||||
// Message on login page
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageLogin").'</td><td colspan="2">';
|
||||
// Editeur wysiwyg
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('main_home',$conf->global->MAIN_HOME,'',142,'dolibarr_notes','In',false,true,true,ROWS_4,90);
|
||||
|
||||
$doleditor = new DolEditor('main_home', $conf->global->MAIN_HOME, '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, 90);
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Message of the day on home page
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("MessageOfDay").'</td><td colspan="2">';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('main_motd',$conf->global->MAIN_MOTD,'',142,'dolibarr_notes','In',false,true,true,ROWS_4,90);
|
||||
|
||||
$doleditor = new DolEditor('main_motd', $conf->global->MAIN_MOTD, '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, 90);
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
/*
|
||||
|
||||
@@ -211,7 +211,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! $_POST['addfile'] && ! $_P
|
||||
$body=make_substitutions($body,$substitutionarrayfortest);
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php");
|
||||
$mailfile = new CMailFile(
|
||||
$mailfile = new CMailFile(
|
||||
$subject,
|
||||
$sendto,
|
||||
$email_from,
|
||||
@@ -224,7 +224,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! $_POST['addfile'] && ! $_P
|
||||
$deliveryreceipt,
|
||||
$msgishtml,
|
||||
$errors_to
|
||||
);
|
||||
);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
|
||||
|
||||
@@ -31,9 +31,14 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||
$langs->load("errors");
|
||||
$langs->load("admin");
|
||||
|
||||
$mode=isset($_GET["mode"])?GETPOST("mode"):(isset($_SESSION['mode'])?$_SESSION['mode']:0);
|
||||
$mode=GETPOST('mode', 'alpha');
|
||||
if (!isset($mode)) {
|
||||
if (isset($_SESSION['mode'])) { $mode=$_SESSION['mode'];}
|
||||
else {$mode=0;}
|
||||
}
|
||||
$mesg=GETPOST("mesg");
|
||||
$action=GETPOST('action');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$value=GETPOST('value', 'alpha');
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
@@ -44,7 +49,7 @@ if (!$user->admin) accessforbidden();
|
||||
|
||||
if ($action == 'set' && $user->admin)
|
||||
{
|
||||
$result=activateModule($_GET["value"]);
|
||||
$result=activateModule($value);
|
||||
$mesg='';
|
||||
if ($result) $mesg=$result;
|
||||
Header("Location: modules.php?mode=".$mode."&mesg=".urlencode($mesg));
|
||||
@@ -53,7 +58,7 @@ if ($action == 'set' && $user->admin)
|
||||
|
||||
if ($action == 'reset' && $user->admin)
|
||||
{
|
||||
$result=unActivateModule($_GET["value"]);
|
||||
$result=unActivateModule($value);
|
||||
$mesg='';
|
||||
if ($result) $mesg=$result;
|
||||
Header("Location: modules.php?mode=".$mode."&mesg=".urlencode($mesg));
|
||||
@@ -128,9 +133,9 @@ foreach ($modulesdir as $dir)
|
||||
{
|
||||
$mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
|
||||
dol_syslog($mesg, LOG_ERR);
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
$res=include_once($dir.$file);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
require("../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/functions2.lib.php");
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("users");
|
||||
@@ -79,37 +80,13 @@ $db->begin();
|
||||
|
||||
// Charge les modules soumis a permissions
|
||||
$modules = array();
|
||||
$modulesdir = array();
|
||||
|
||||
foreach ($conf->file->dol_document_root as $type => $dirroot)
|
||||
{
|
||||
$modulesdir[] = $dirroot . "/core/modules/";
|
||||
|
||||
if ($type == 'alt')
|
||||
{
|
||||
$handle=@opendir($dirroot);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
|
||||
{
|
||||
if (is_dir($dirroot . '/' . $file . '/core/modules/'))
|
||||
{
|
||||
$modulesdir[] = $dirroot . '/' . $file . '/core/modules/';
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
// Load modules attributes in arrays (name, numero, orders) from dir directory
|
||||
//print $dir."\n<br>";
|
||||
$handle=@opendir($dir);
|
||||
$handle=@opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
@@ -135,7 +112,6 @@ foreach ($modulesdir as $dir)
|
||||
if ($objMod->rights_class)
|
||||
{
|
||||
$ret=$objMod->insert_permissions(0);
|
||||
|
||||
$modules[$objMod->rights_class]=$objMod;
|
||||
//print "modules[".$objMod->rights_class."]=$objMod;";
|
||||
}
|
||||
@@ -151,7 +127,7 @@ $db->commit();
|
||||
$sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql.= " AND entity in (".(!empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
|
||||
$sql.= " AND entity IN (".(! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")";
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
||||
$sql.= " ORDER BY r.module, r.id";
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ print '<td>'.$langs->trans("ConnectionTimeout").'</td><td align="right">';
|
||||
print '</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
print '<input class="flat" name="MAIN_USE_CONNECT_TIMEOUT" type="text" size="4" value="'.$conf->global->MAIN_USE_CONNECT_TIMEOUT.'">';
|
||||
print ' '.$langs->trans("seconds");
|
||||
print ' '.strtolower($langs->trans("Seconds"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -134,7 +134,7 @@ print '<td>'.$langs->trans("ResponseTimeout").'</td><td align="right">';
|
||||
print '</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
print '<input class="flat" name="MAIN_USE_RESPONSE_TIMEOUT" type="text" size="4" value="'.$conf->global->MAIN_USE_RESPONSE_TIMEOUT.'">';
|
||||
print ' '.$langs->trans("seconds");
|
||||
print ' '.strtolower($langs->trans("Seconds"));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ print '<td>'.$langs->trans("SessionTimeOut").'</td><td align="right">';
|
||||
print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
|
||||
print '</td>';
|
||||
print '<td nowrap="nowrap">';
|
||||
print '<input class="flat" name="MAIN_SESSION_TIMEOUT" type="text" size="6" value="'.htmlentities($conf->global->MAIN_SESSION_TIMEOUT).'"> '.$langs->trans("seconds");
|
||||
print '<input class="flat" name="MAIN_SESSION_TIMEOUT" type="text" size="6" value="'.htmlentities($conf->global->MAIN_SESSION_TIMEOUT).'"> '.strtolower($langs->trans("Seconds"));
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
|
||||
|
||||
@@ -75,7 +75,7 @@ print "<br>\n";
|
||||
|
||||
// Php
|
||||
print '<table class="noborder" width="100%">';
|
||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("Php")."</td></tr>\n";
|
||||
print "<tr class=\"liste_titre\"><td colspan=\"2\">".$langs->trans("PHP")."</td></tr>\n";
|
||||
$phpversion=version_php();
|
||||
print "<tr $bc[0]><td width=\"280\">".$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
|
||||
print "<tr $bc[1]><td>".$langs->trans("PhpWebLink")."</td><td>".php_sapi_name()."</td></tr>\n";
|
||||
|
||||
@@ -158,7 +158,7 @@ if ($what == 'mysql')
|
||||
if (! empty($dolibarr_main_db_pass))
|
||||
{
|
||||
$paramcrypted.=' -p"'.preg_replace('/./i','*',$dolibarr_main_db_pass).'"';
|
||||
$paramclear.=' -p"'.str_replace('"','\"',$dolibarr_main_db_pass).'"';
|
||||
$paramclear.=' -p"'.str_replace(array('"','`'),array('\"','\`'),$dolibarr_main_db_pass).'"';
|
||||
}
|
||||
|
||||
print '<b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
|
||||
@@ -80,6 +80,7 @@ $workflowcodes=array();
|
||||
$workflow=array(
|
||||
'order' => array(
|
||||
'propal' => array('WORKFLOW_PROPAL_AUTOCREATE_ORDER')
|
||||
//,'invoice' => array('WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER')
|
||||
),
|
||||
'invoice' => array (
|
||||
'order' => array('WORKFLOW_ORDER_AUTOCREATE_INVOICE')
|
||||
|
||||
@@ -39,9 +39,9 @@ print '<tr><td valign="top" width="40%" class="notopnoleft">';
|
||||
|
||||
|
||||
/*
|
||||
/* Chiffre d'affaire
|
||||
/* Chiffre d'affaires
|
||||
*/
|
||||
//print_barre_liste("Chiffre d'affaire", $page, "ca.php");
|
||||
//print_barre_liste("Chiffre d'affaires", $page, "ca.php");
|
||||
|
||||
print_titre($langs->trans('SalesTurnover'));
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ if ($id || $ref)
|
||||
$elementtype = 'fournisseur';
|
||||
$objecttype = 'societe&categorie';
|
||||
$objectid = isset($id)?$id:(isset($socid)?$socid:'');
|
||||
$dbtablename = '&societe';
|
||||
$fieldid = 'rowid';
|
||||
}
|
||||
if ($type == 2) {
|
||||
|
||||
@@ -889,17 +889,14 @@ class Categorie
|
||||
}
|
||||
else // mother_id undefined (so it's root)
|
||||
{
|
||||
/* We have to select any rowid from llx_categorie which which category's type and label
|
||||
* are equals to those of the calling category, AND which doesn't exist in categorie association
|
||||
* as children (rowid != fk_categorie_fille)
|
||||
*/
|
||||
$sql = "SELECT c.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c ";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."categorie_association as ca";
|
||||
$sql.= " ON c.rowid!=ca.fk_categorie_fille";
|
||||
$sql.= " WHERE c.type=".$this->type;
|
||||
$sql.= " AND c.label='".$this->db->escape($this->label)."'";
|
||||
$sql.= " AND c.entity IN (".getEntity('category',1).")";
|
||||
/* We have to select any rowid from llx_categorie that is not at root level
|
||||
*/
|
||||
$sql = "SELECT c.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c ";
|
||||
$sql.= " WHERE c.type=".$this->type;
|
||||
$sql.= " AND c.label='".$this->db->escape($this->label)."'";
|
||||
$sql.= " AND c.entity IN (".getEntity('category',1).")";
|
||||
$sql.= " AND c.rowid NOT IN (SELECT ca.fk_categorie_fille FROM ".MAIN_DB_PREFIX."categorie_association as ca)";
|
||||
}
|
||||
dol_syslog(get_class($this)."::already_exists sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@@ -85,13 +85,14 @@ if ($action == 'add_action')
|
||||
}
|
||||
|
||||
$fulldayevent=$_POST["fullday"];
|
||||
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status
|
||||
|
||||
// Clean parameters
|
||||
$datep=dol_mktime($fulldayevent?'00':$_POST["aphour"], $fulldayevent?'00':$_POST["apmin"], 0, $_POST["apmonth"], $_POST["apday"], $_POST["apyear"]);
|
||||
$datef=dol_mktime($fulldayevent?'23':$_POST["p2hour"], $fulldayevent?'59':$_POST["p2min"], $fulldayevent?'59':'0', $_POST["p2month"], $_POST["p2day"], $_POST["p2year"]);
|
||||
|
||||
// Check parameters
|
||||
if (! $datef && $_POST["percentage"] == 100)
|
||||
if (! $datef && $percentage == 100)
|
||||
{
|
||||
$error++;
|
||||
$action = 'create';
|
||||
@@ -135,7 +136,7 @@ if ($action == 'add_action')
|
||||
$actioncomm->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0;
|
||||
$actioncomm->datep = $datep;
|
||||
$actioncomm->datef = $datef;
|
||||
$actioncomm->percentage = isset($_POST["percentage"])?$_POST["percentage"]:0;
|
||||
$actioncomm->percentage = $percentage;
|
||||
$actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
|
||||
|
||||
$usertodo=new User($db);
|
||||
@@ -257,21 +258,20 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == 'yes')
|
||||
}
|
||||
|
||||
/*
|
||||
* Action mise a jour de l'action
|
||||
* Action update event
|
||||
*/
|
||||
if ($action == 'update')
|
||||
{
|
||||
if (! $_POST["cancel"])
|
||||
{
|
||||
$fulldayevent=$_POST["fullday"];
|
||||
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status
|
||||
|
||||
// Clean parameters
|
||||
if ($_POST["aphour"] == -1) $_POST["aphour"]='0';
|
||||
if ($_POST["apmin"] == -1) $_POST["apmin"]='0';
|
||||
if ($_POST["p2hour"] == -1) $_POST["p2hour"]='0';
|
||||
if ($_POST["p2min"] == -1) $_POST["p2min"]='0';
|
||||
//if ($_POST["adhour"] == -1) $_POST["adhour"]='0';
|
||||
//if ($_POST["admin"] == -1) $_POST["admin"]='0';
|
||||
|
||||
$actioncomm = new Actioncomm($db);
|
||||
$actioncomm->fetch($id);
|
||||
@@ -282,9 +282,7 @@ if ($action == 'update')
|
||||
$actioncomm->label = $_POST["label"];
|
||||
$actioncomm->datep = $datep;
|
||||
$actioncomm->datef = $datef;
|
||||
//$actioncomm->date = $datea;
|
||||
//$actioncomm->dateend = $datea2;
|
||||
$actioncomm->percentage = $_POST["percentage"];
|
||||
$actioncomm->percentage = $percentage;
|
||||
$actioncomm->priority = $_POST["priority"];
|
||||
$actioncomm->fulldayevent= $_POST["fullday"]?1:0;
|
||||
$actioncomm->location = isset($_POST["location"])?$_POST["location"]:'';
|
||||
@@ -294,7 +292,7 @@ if ($action == 'update')
|
||||
$actioncomm->note = $_POST["note"];
|
||||
$actioncomm->pnote = $_POST["note"];
|
||||
|
||||
if (! $datef && $_POST["percentage"] == 100)
|
||||
if (! $datef && $percentage == 100)
|
||||
{
|
||||
$error=$langs->trans("ErrorFieldRequired",$langs->trans("DateEnd"));
|
||||
$action = 'edit';
|
||||
@@ -447,7 +445,7 @@ if ($action == 'create')
|
||||
print '<tr><td>'.$langs->trans("Title").'</td><td><input type="text" name="label" size="60" value="'.GETPOST('label').'"></td></tr>';
|
||||
|
||||
// Full day
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked="checked"':'').'></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked="checked"':'').'></td></tr>';
|
||||
|
||||
// Date start
|
||||
$datep=$actioncomm->datep;
|
||||
@@ -687,7 +685,7 @@ if ($id)
|
||||
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$act->label.'"></td></tr>';
|
||||
|
||||
// Full day event
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($act->fulldayevent?' checked="checked"':'').'></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($act->fulldayevent?' checked="checked"':'').'></td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td nowrap="nowrap" class="fieldrequired">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
|
||||
|
||||
@@ -744,11 +744,13 @@ if (! is_array($theme_datacolor)) $theme_datacolor=array(array(120,130,150), arr
|
||||
if (empty($action) || $action == 'show_month') // View by month
|
||||
{
|
||||
$newparam=$param; // newparam is for birthday links
|
||||
$newparam=preg_replace('/showbirthday=/i','showbirthday_=',$newparam); // To avoid replacement when replace day= is done
|
||||
$newparam=preg_replace('/action=show_month&?/i','',$newparam);
|
||||
$newparam=preg_replace('/action=show_week&?/i','',$newparam);
|
||||
$newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam);
|
||||
$newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam);
|
||||
$newparam=preg_replace('/day=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/month=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter
|
||||
echo '<table width="100%" class="nocellnopadd">';
|
||||
echo ' <tr class="liste_titre">';
|
||||
$i=0;
|
||||
@@ -810,11 +812,13 @@ if (empty($action) || $action == 'show_month') // View by month
|
||||
elseif ($action == 'show_week') // View by week
|
||||
{
|
||||
$newparam=$param; // newparam is for birthday links
|
||||
$newparam=preg_replace('/showbirthday=/i','showbirthday_=',$newparam); // To avoid replacement when replace day= is done
|
||||
$newparam=preg_replace('/action=show_month&?/i','',$newparam);
|
||||
$newparam=preg_replace('/action=show_week&?/i','',$newparam);
|
||||
$newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam);
|
||||
$newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam);
|
||||
$newparam=preg_replace('/day=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/month=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
|
||||
$newparam=preg_replace('/showbirthday_=/i','showbirthday=',$newparam); // Restore correct parameter
|
||||
echo '<table width="100%" class="nocellnopadd">';
|
||||
echo ' <tr class="liste_titre">';
|
||||
$i=0;
|
||||
@@ -866,9 +870,6 @@ else // View by day
|
||||
$newparam=$param; // newparam is for birthday links
|
||||
$newparam=preg_replace('/action=show_month&?/i','',$newparam);
|
||||
$newparam=preg_replace('/action=show_week&?/i','',$newparam);
|
||||
$newparam=preg_replace('/day=[0-9][0-9]&?/i','',$newparam);
|
||||
$newparam=preg_replace('/month=[0-9][0-9]&?/i','',$newparam);
|
||||
$newparam=preg_replace('/year=[0-9]+&?/i','',$newparam);
|
||||
// Code to show just one day
|
||||
$style='cal_current_month';
|
||||
$today=0;
|
||||
|
||||
@@ -51,11 +51,11 @@ $object = new Address($db);
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Cancel
|
||||
if (GETPOST("cancel") && ! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
// Cancel
|
||||
if (GETPOST("cancel") && ! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'add' || $action == 'update')
|
||||
@@ -80,7 +80,7 @@ if ($action == 'add' || $action == 'update')
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
Header("Location: ".$backtopage);
|
||||
Header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
else if ($origin == 'commande')
|
||||
@@ -93,10 +93,10 @@ if ($action == 'add' || $action == 'update')
|
||||
Header("Location: ../comm/propal/contact.php?action=editdelivery_adress&socid=".$socid."&id=".$originid);
|
||||
exit;
|
||||
}
|
||||
elseif ($origin == 'shipment')
|
||||
{
|
||||
Header("Location: ../expedition/fiche.php?id=".$originid);
|
||||
exit;
|
||||
elseif ($origin == 'shipment')
|
||||
{
|
||||
Header("Location: ../expedition/fiche.php?id=".$originid);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,10 +118,10 @@ if ($action == 'add' || $action == 'update')
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
Header("Location: ".$backtopage);
|
||||
exit;
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
Header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
else if ($origin == 'commande')
|
||||
{
|
||||
@@ -286,10 +286,10 @@ if ($action == 'create')
|
||||
|
||||
print '<br><center>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Add').'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</center>'."\n";
|
||||
|
||||
@@ -384,10 +384,10 @@ elseif ($action == 'edit')
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<center>';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@@ -87,14 +87,14 @@ if ($action == 'setcustomeraccountancycode')
|
||||
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
// mode de reglement
|
||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
// assujetissement a la TVA
|
||||
@@ -796,10 +796,10 @@ if ($id > 0)
|
||||
show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
// Addresses list
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB))
|
||||
{
|
||||
$result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
// Addresses list
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB))
|
||||
{
|
||||
$result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
|
||||
@@ -60,11 +60,11 @@ $substitutionarray=array(
|
||||
if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE)
|
||||
{
|
||||
$substitutionarray=array_merge(
|
||||
$substitutionarray,
|
||||
array(
|
||||
'__CHECK_READ__' => 'CheckMail',
|
||||
'__UNSUSCRIBE__' => 'Unsuscribe'
|
||||
)
|
||||
$substitutionarray,
|
||||
array(
|
||||
'__CHECK_READ__' => 'CheckMail',
|
||||
'__UNSUBSCRIBE__' => 'Unsubscribe'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,13 +83,13 @@ $substitutionarrayfortest=array(
|
||||
);
|
||||
if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE)
|
||||
{
|
||||
$substitutionarrayfortest=array_merge(
|
||||
$substitutionarrayfortest,
|
||||
array(
|
||||
'__CHECK_READ__' => 'TESTCheckMail',
|
||||
'__UNSUSCRIBE__' => 'TESTCheckMail'
|
||||
)
|
||||
);
|
||||
$substitutionarrayfortest=array_merge(
|
||||
$substitutionarrayfortest,
|
||||
array(
|
||||
'__CHECK_READ__' => 'TESTCheckMail',
|
||||
'__UNSUBSCRIBE__' => 'TESTUnsubscribe'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Action clone object
|
||||
@@ -209,7 +209,7 @@ if ($action == 'sendallconfirmed' && $confirm == 'yes')
|
||||
'__ID__' => $obj->source_id,
|
||||
'__EMAIL__' => $obj->email,
|
||||
'__CHECK_READ__' => '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'" width="0" height="0" style="width:0px;height:0px" border="0"/>',
|
||||
'__UNSUSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
||||
'__UNSUBSCRIBE__' => '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>',
|
||||
'__LASTNAME__' => $obj->nom,
|
||||
'__FIRSTNAME__' => $obj->prenom,
|
||||
'__OTHER1__' => $other1,
|
||||
@@ -547,60 +547,60 @@ if ($action == 'update' && empty($_POST["removedfile"]) && empty($_POST["cancel"
|
||||
|
||||
// Action confirmation validation
|
||||
if ($action == 'confirm_valid' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->fetch($id) >= 0)
|
||||
{
|
||||
$object->valid($user);
|
||||
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
{
|
||||
if ($object->fetch($id) >= 0)
|
||||
{
|
||||
$object->valid($user);
|
||||
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Resend
|
||||
if ($action == 'confirm_reset' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->fetch($id) >= 0)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result=$object->valid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$result=$object->reset_targets_status($user);
|
||||
}
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
{
|
||||
if ($object->fetch($id) >= 0)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$result=$object->valid($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$result=$object->reset_targets_status($user);
|
||||
}
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg=$object->error;
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Action confirmation suppression
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
if ($object->delete($object->id))
|
||||
{
|
||||
Header("Location: liste.php");
|
||||
exit;
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
if ($object->delete($object->id))
|
||||
{
|
||||
Header("Location: liste.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1049,7 +1049,7 @@ else
|
||||
if ($conf->global->MAILING_EMAIL_UNSUBSCRIBE)
|
||||
{
|
||||
print '__CHECK_READ__ = '.$langs->trans("CheckRead").'<br>';
|
||||
print '__UNSUSCRIBE__ = '.$langs->trans("MailUnsubcribe").'<br>';
|
||||
print '__UNSUBSCRIBE__ = '.$langs->trans("MailUnsubcribe").'<br>';
|
||||
}
|
||||
print '__LASTNAME__ = '.$langs->trans("Lastname").'<br>';
|
||||
print '__FIRSTNAME__ = '.$langs->trans("Firstname").'<br>';
|
||||
|
||||
@@ -87,7 +87,7 @@ $result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||
$object = new Propal($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
}
|
||||
@@ -154,29 +154,29 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->prop
|
||||
// Remove line
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result = $object->deleteline($lineid);
|
||||
// reorder lines
|
||||
if ($result) $object->line_order(true);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$ret=$object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||
}
|
||||
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result = $object->deleteline($lineid);
|
||||
// reorder lines
|
||||
if ($result) $object->line_order(true);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$ret=$object->fetch($id); // Reload to get new records
|
||||
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||
}
|
||||
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -248,18 +248,18 @@ else if ($action == 'set_ref_client' && $user->rights->propale->creer)
|
||||
$object->set_ref_client($user, $_POST['ref_client']);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
else if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
// Create proposal
|
||||
@@ -952,6 +952,23 @@ else if ($action == 'builddoc' && $user->rights->propale->creer)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file')
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->propal->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Set project
|
||||
else if ($action == 'classin' && $user->rights->propale->creer)
|
||||
{
|
||||
@@ -1049,63 +1066,63 @@ else if ($action == 'down' && $user->rights->propale->creer)
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||
{
|
||||
if ($object->fetch($id) > 0)
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||
{
|
||||
if ($object->fetch($id) > 0)
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1544,19 +1561,19 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
@@ -1888,9 +1905,9 @@ else
|
||||
{
|
||||
$sql.= " AND p.ref LIKE '%".$db->escape(trim($search_ref))."%'";
|
||||
}
|
||||
if ($search_refcustomer)
|
||||
{
|
||||
$sql.= " AND p.ref_client LIKE '%".$db->escape(trim($search_refcustomer))."%'";
|
||||
if ($search_refcustomer)
|
||||
{
|
||||
$sql.= " AND p.ref_client LIKE '%".$db->escape(trim($search_refcustomer))."%'";
|
||||
}
|
||||
if ($search_societe)
|
||||
{
|
||||
@@ -1963,8 +1980,8 @@ else
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="16" name="search_societe" value="'.$search_societe.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="10" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1" align="center">';
|
||||
print $langs->trans('Month').': <input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||
@@ -2032,8 +2049,8 @@ else
|
||||
print '</td>';
|
||||
|
||||
// Customer ref
|
||||
print '<td nowrap="nowrap">';
|
||||
print $objp->ref_client;
|
||||
print '<td nowrap="nowrap">';
|
||||
print $objp->ref_client;
|
||||
print '</td>';
|
||||
|
||||
// Date propale
|
||||
|
||||
@@ -969,7 +969,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", p.fk_cond_reglement";
|
||||
$sql.= ", p.fk_mode_reglement";
|
||||
$sql.= ", c.label as statut_label";
|
||||
$sql.= ", ca.code as availability_code, ca.label as availability";
|
||||
$sql.= ", ca.code as availability_code, ca.label as availability";
|
||||
$sql.= ", dr.code as demand_reason_code, dr.label as demand_reason";
|
||||
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
|
||||
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
|
||||
@@ -1801,11 +1801,11 @@ class Propal extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
// We remove directory
|
||||
$propalref = dol_sanitizeFileName($this->ref);
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->propal->dir_output)
|
||||
{
|
||||
$dir = $conf->propal->dir_output . "/" . $propalref ;
|
||||
$file = $conf->propal->dir_output . "/" . $propalref . "/" . $propalref . ".pdf";
|
||||
$dir = $conf->propal->dir_output . "/" . $ref ;
|
||||
$file = $dir . "/" . $ref . ".pdf";
|
||||
if (file_exists($file))
|
||||
{
|
||||
dol_delete_preview($this);
|
||||
@@ -1819,7 +1819,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$res=@dol_delete_dir($dir);
|
||||
$res=@dol_delete_dir_recursive($dir);
|
||||
if (! $res)
|
||||
{
|
||||
$this->error='ErrorFailToDeleteDir';
|
||||
@@ -2163,7 +2163,7 @@ class Propal extends CommonObject
|
||||
$this->mode_reglement_id = 7;
|
||||
$this->mode_reglement_code = 'CHQ';
|
||||
$this->availability_id = 1;
|
||||
$this->availability_code = 'DSP';
|
||||
$this->availability_code = 'AV_NOW';
|
||||
$this->demand_reason_id = 1;
|
||||
$this->demand_reason_code = 'SRC_00';
|
||||
$this->note_public='This is a comment (public)';
|
||||
|
||||
@@ -110,11 +110,11 @@ else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setaddress' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setDeliveryAddress($_POST['fk_address']);
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
else if ($action == 'setaddress' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->setDeliveryAddress($_POST['fk_address']);
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,27 +174,27 @@ if ($id > 0 || ! empty($ref))
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Delivery address
|
||||
if ($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
if ($action == 'editdelivery_address')
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'fk_address','propal',$object->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'none','propal',$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Delivery address
|
||||
if ($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
if ($action == 'editdelivery_address')
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'fk_address','propal',$object->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'none','propal',$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@@ -34,10 +34,17 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
$langs->load('compta');
|
||||
$langs->load('other');
|
||||
|
||||
$action = GETPOST('action');
|
||||
$confirm = GETPOST('confirm');
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id)
|
||||
@@ -59,6 +66,11 @@ if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
$object = new Propal($db);
|
||||
$object->fetch($id,$ref);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -67,7 +79,7 @@ $object = new Propal($db);
|
||||
// Envoi fichier
|
||||
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
@@ -112,15 +124,16 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
// Delete
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$langs->load("other");
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,83 +146,73 @@ llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
if ($object->id > 0)
|
||||
{
|
||||
if ($object->fetch($id,$ref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$head = propal_prepare_head($object);
|
||||
dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border"width="100%">';
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal.php'."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder".'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_htmloutput_mesg($mesg,$mesgs);
|
||||
|
||||
/*
|
||||
* Confirmation suppression fichier
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object);
|
||||
|
||||
|
||||
// List of document
|
||||
$param='&id='.$object->id;
|
||||
$formfile->list_of_documents($filearray,$object,'propal',$param);
|
||||
|
||||
}
|
||||
else
|
||||
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$head = propal_prepare_head($object);
|
||||
dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','\.meta$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$totalsize=0;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
dol_print_error($db);
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border"width="100%">';
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal.php'."?page=$page&socid=$socid&viewstatut=$viewstatut&sortfield=$sortfield&$sortorder".'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref client
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td nowrap>';
|
||||
print $langs->trans('RefCustomer').'</td><td align="left">';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
print $object->ref_client;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_htmloutput_mesg($mesg,$mesgs);
|
||||
|
||||
/*
|
||||
* Confirmation suppression fichier
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id,'',0,0,$user->rights->propale->creer,50,$object);
|
||||
|
||||
|
||||
// List of document
|
||||
$param='&id='.$object->id;
|
||||
$formfile->list_of_documents($filearray,$object,'propal',$param);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -184,16 +184,16 @@ if ($conf->propal->enabled)
|
||||
$obj = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
$propalstatic->id=$obj->rowid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
$propalstatic->id=$obj->rowid;
|
||||
$propalstatic->ref=$obj->ref;
|
||||
print '<td nowrap="nowrap">'.$propalstatic->getNomUrl(1).'</td>';
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td>'.$companystatic->getNomUrl(1,'customer',24).'</td>';
|
||||
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
@@ -260,17 +260,17 @@ if ($resql)
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||
|
||||
|
||||
print '<td>'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
|
||||
print '<td align="right">'.$propalstatic->LibStatut($obj->fk_statut,5).'</td>';
|
||||
print '</tr>';
|
||||
@@ -339,11 +339,11 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
print '</td></tr></table>';
|
||||
|
||||
print "</td>";
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->name=$obj->socname;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->canvas=$obj->canvas;
|
||||
print '<td align="left">'.$companystatic->getNomUrl(1,'customer',44).'</td>'."\n";
|
||||
|
||||
print '<td align="right">';
|
||||
@@ -419,7 +419,7 @@ if ($conf->propal->enabled)
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
@@ -491,7 +491,7 @@ if ($conf->propal->enabled)
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
$formfile->show_documents('propal',$filename,$filedir,$urlsource,'','','',1,'',1);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
|
||||
@@ -47,18 +47,18 @@ $object = new Propal($db);
|
||||
/* Actions */
|
||||
/******************************************************************************/
|
||||
|
||||
if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
if ($action == 'setnote_public' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->propale->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -66,7 +67,6 @@ $stats = new PropaleStats($db, $socid, $userid);
|
||||
|
||||
// Build graphic number of object
|
||||
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@ if (! $mesg)
|
||||
|
||||
// Build graphic amount of object
|
||||
$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
|
||||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
@@ -151,13 +150,7 @@ if (! $mesg)
|
||||
$px2->draw($filenameamount,$fileurlamount);
|
||||
}
|
||||
|
||||
|
||||
$res = $stats->getAverageByMonth($year);
|
||||
$data = array();
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
|
||||
}
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
@@ -177,8 +170,7 @@ $mesg = $px3->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px3->SetData($data);
|
||||
//$i=$startyear;$legend=array();
|
||||
$i=$endyear;$legend=array();
|
||||
$i=$startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
@@ -220,34 +212,36 @@ complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_stats');
|
||||
|
||||
dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
|
||||
|
||||
if (empty($socid))
|
||||
{
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
$filter='s.client in (1,2,3)';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
$filter='s.client in (1,2,3)';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -272,7 +272,7 @@ if ($socid > 0)
|
||||
print '<td><input type="text" size="5" name="amount_ht" value="'.$_POST["amount_ht"].'"> '.$langs->trans("Currency".$conf->currency).'</td></tr>';
|
||||
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
|
||||
print '<td>';
|
||||
print $form->load_tva('tva_tx',GETPOST('tva_tx'),'',$mysoc,'');
|
||||
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$objsoc);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("NoteReason").'</td>';
|
||||
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
|
||||
|
||||
@@ -282,7 +282,7 @@ class Commande extends CommonObject
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Suppression ancien fichier PDF dans nouveau rep
|
||||
dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'.*');
|
||||
dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'*.*');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -684,7 +684,7 @@ class Commande extends CommonObject
|
||||
$this->lines[$i]->remise_percent,
|
||||
$this->lines[$i]->info_bits,
|
||||
$this->lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
'HT',
|
||||
0,
|
||||
$this->lines[$i]->date_start,
|
||||
$this->lines[$i]->date_end,
|
||||
@@ -923,13 +923,13 @@ class Commande extends CommonObject
|
||||
$this->note_public = $object->note_public;
|
||||
|
||||
$this->origin = $object->element;
|
||||
$this->origin_id = $object->id;
|
||||
|
||||
// Possibility to add external linked objects with hooks
|
||||
$this->linked_objects[$this->origin] = $this->origin_id;
|
||||
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
|
||||
{
|
||||
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
|
||||
$this->origin_id = $object->id;
|
||||
|
||||
// Possibility to add external linked objects with hooks
|
||||
$this->linked_objects[$this->origin] = $this->origin_id;
|
||||
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
|
||||
{
|
||||
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
|
||||
}
|
||||
|
||||
$ret = $this->create($user);
|
||||
@@ -939,7 +939,7 @@ class Commande extends CommonObject
|
||||
// Actions hooked (by external module)
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('orderdao'));
|
||||
@@ -2069,11 +2069,16 @@ class Commande extends CommonObject
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0 ;';
|
||||
if ($this->db->query($sql) )
|
||||
{
|
||||
if (($conf->global->PROPALE_CLASSIFIED_INVOICED_WITH_ORDER == 1) && $this->propale_id)
|
||||
if (! empty($conf->propal->enabled) && ! empty($conf->global->PROPALE_CLASSIFIED_INVOICED_WITH_ORDER))
|
||||
{
|
||||
$propal = new Propal($this->db);
|
||||
$propal->fetch($this->propale_id);
|
||||
$propal->classer_facturee();
|
||||
$this->fetchObjectLinked('','propal',$this->id,$this->element);
|
||||
if (! empty($this->linkedObjects))
|
||||
{
|
||||
foreach($this->linkedObjects['propal'] as $element)
|
||||
{
|
||||
$ret=$element->classer_facturee();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -2105,7 +2110,7 @@ class Commande extends CommonObject
|
||||
* @param int $skip_update_total Skip update of total
|
||||
* @return int < 0 if KO, > 0 if OK
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0)
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -2176,6 +2181,7 @@ class Commande extends CommonObject
|
||||
$this->line->remise_percent=$remise_percent;
|
||||
$this->line->subprice=$subprice;
|
||||
$this->line->info_bits=$info_bits;
|
||||
$this->line->special_code=0; // To remove special_code=3 coming from proposals copy
|
||||
$this->line->total_ht=$total_ht;
|
||||
$this->line->total_tva=$total_tva;
|
||||
$this->line->total_localtax1=$total_localtax1;
|
||||
@@ -2294,7 +2300,7 @@ class Commande extends CommonObject
|
||||
}
|
||||
if (file_exists($dir))
|
||||
{
|
||||
if (! dol_delete_dir($dir))
|
||||
if (! dol_delete_dir_recursive($dir))
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
|
||||
$this->db->rollback();
|
||||
@@ -3030,6 +3036,7 @@ class OrderLine
|
||||
if (empty($this->remise)) $this->remise=0;
|
||||
if (empty($this->remise_percent)) $this->remise_percent=0;
|
||||
if (empty($this->info_bits)) $this->info_bits=0;
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->product_type)) $this->product_type=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
|
||||
@@ -3055,6 +3062,7 @@ class OrderLine
|
||||
$sql.= " , total_localtax1=".price2num($this->total_localtax1);
|
||||
$sql.= " , total_localtax2=".price2num($this->total_localtax2);
|
||||
$sql.= " , info_bits=".$this->info_bits;
|
||||
$sql.= " , special_code=".$this->special_code;
|
||||
if ($this->date_start) { $sql.= " , date_start='".$this->db->idate($this->date_start)."'"; }
|
||||
else { $sql.=' , date_start=null'; }
|
||||
if ($this->date_end) { $sql.= " , date_end='".$this->db->idate($this->date_end)."'"; }
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -45,7 +46,7 @@ class CommandeStats extends Stats
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
* @param int $socid Id third party for filter
|
||||
* @param string $mode Option
|
||||
* @param int $userid Id user for filter
|
||||
@@ -73,7 +74,7 @@ class CommandeStats extends Stats
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||
$this->from.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$this->field='total_ht';
|
||||
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
$this->where.= " c.fk_statut > 2"; // Only approved & ordered
|
||||
}
|
||||
$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
|
||||
|
||||
@@ -106,10 +106,10 @@ else if ($action == 'deletecontact' && $user->rights->commande->creer)
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setaddress' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setDeliveryAddress($_POST['fk_address']);
|
||||
else if ($action == 'setaddress' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setDeliveryAddress($_POST['fk_address']);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -173,27 +173,27 @@ if ($id > 0 || ! empty($ref))
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Delivery address
|
||||
if ($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
if ($action == 'editdelivery_address')
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'fk_address','commande',$object->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'none','commande',$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Delivery address
|
||||
if ($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DeliveryAddress');
|
||||
print '</td>';
|
||||
|
||||
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&socid='.$object->socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
|
||||
if ($action == 'editdelivery_address')
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'fk_address','commande',$object->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'none','commande',$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@@ -40,6 +40,13 @@ $confirm = GETPOST('confirm');
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref');
|
||||
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id)
|
||||
{
|
||||
@@ -59,7 +66,6 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$object = new Commande($db);
|
||||
|
||||
|
||||
@@ -113,7 +119,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
else if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
@@ -123,7 +129,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +185,7 @@ if ($id > 0 || ! empty($ref))
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ $result=restrictedArea($user,'commande',$id,'');
|
||||
|
||||
$object = new Commande($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
@@ -507,18 +507,18 @@ else if ($action == 'setremiseabsolue' && $user->rights->commande->creer)
|
||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
else if ($action == 'setnote_public' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -738,6 +738,11 @@ else if ($action == 'updateligne' && $user->rights->commande->creer && $_POST['s
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
||||
$result = -1 ;
|
||||
}
|
||||
|
||||
// Define special_code for special lines
|
||||
$special_code=0;
|
||||
if (empty($_POST['qty'])) $special_code=3;
|
||||
|
||||
// Check minimum price
|
||||
if(! empty($_POST['productid']))
|
||||
{
|
||||
@@ -1024,10 +1029,12 @@ else if ($action == 'remove_file')
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->commande->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
dol_delete_file($file);
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
}
|
||||
@@ -1220,64 +1227,64 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->commande->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
if ($action == 'addcontact' && $user->rights->commande->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->commande->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->commande->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1300,6 +1307,9 @@ $formorder = new FormOrder($db);
|
||||
*********************************************************************/
|
||||
if ($action == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
|
||||
print_fiche_titre($langs->trans('CreateOrder'));
|
||||
|
||||
dol_htmloutput_mesg($mesg,$mesgs,'error');
|
||||
@@ -1486,13 +1496,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print $form->selectarray('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
|
||||
// Note publique
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_public" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
|
||||
print '</td></tr>';
|
||||
@@ -1503,8 +1512,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
|
||||
$doleditor = new DolEditor('note', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note" wrap="soft" cols="70" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
|
||||
print '</td></tr>';
|
||||
@@ -2045,24 +2054,24 @@ else
|
||||
print '<td colspan="2">'.$object->getLibStatut(4).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table><br>';
|
||||
print '</table><br>';
|
||||
print "\n";
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -168,12 +170,7 @@ if (! $mesg)
|
||||
}
|
||||
|
||||
|
||||
$res = $stats->getAverageByMonth($year);
|
||||
$data = array();
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
|
||||
}
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
@@ -193,8 +190,7 @@ $mesg = $px3->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px3->SetData($data);
|
||||
//$i=$startyear;$legend=array();
|
||||
$i=$endyear;$legend=array();
|
||||
$i=$startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
@@ -240,34 +236,37 @@ complete_head_from_modules($conf,$langs,$object,$head,$h,$type);
|
||||
|
||||
dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
|
||||
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
if (empty($socid))
|
||||
{
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
|
||||
@@ -48,6 +48,7 @@ $fieldtype = (! empty($ref) ? 'ref' :'rowid');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'banque',$fieldvalue,'bank_account','','',$fieldtype);
|
||||
|
||||
$paiementtype=GETPOST('paiementtype','alpha',3);
|
||||
$req_nb=GETPOST("req_nb",'',3);
|
||||
$thirdparty=GETPOST("thirdparty",'',3);
|
||||
$vline=GETPOST("vline");
|
||||
@@ -78,17 +79,17 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
|
||||
{
|
||||
$amount = - price2num($_POST["debit"]);
|
||||
}
|
||||
|
||||
|
||||
$dateop = dol_mktime(12,0,0,$_POST["opmonth"],$_POST["opday"],$_POST["opyear"]);
|
||||
$operation=$_POST["operation"];
|
||||
$num_chq=$_POST["num_chq"];
|
||||
$label=$_POST["label"];
|
||||
$cat1=$_POST["cat1"];
|
||||
|
||||
|
||||
if (! $dateop) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Date"));
|
||||
if (! $operation) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Type"));
|
||||
if (! $amount) $mesg=$langs->trans("ErrorFieldRequired",$langs->trans("Amount"));
|
||||
|
||||
|
||||
if (! $mesg)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@@ -143,15 +144,15 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
$result=$object->fetch($id, $ref);
|
||||
|
||||
|
||||
// Chargement des categories bancaires dans $options
|
||||
$nbcategories=0;
|
||||
|
||||
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ";
|
||||
$sql.= " WHERE entity = ".$conf->entity;
|
||||
$sql.= " ORDER BY label";
|
||||
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@@ -168,7 +169,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
|
||||
// Definition de sql_rech et param
|
||||
$param='';
|
||||
$sql_rech='';
|
||||
@@ -203,13 +204,13 @@ if ($id > 0 || ! empty($ref))
|
||||
$param.='&thirdparty='.urlencode($thirdparty);
|
||||
$mode_search = 1;
|
||||
}
|
||||
if (GETPOST("paiementtype"))
|
||||
if ($paiementtype)
|
||||
{
|
||||
$sql_rech.=" AND b.fk_type = '".$db->escape(GETPOST("paiementtype"))."'";
|
||||
$param.='&paiementtype='.urlencode(GETPOST("paiementtype"));
|
||||
$sql_rech.=" AND b.fk_type = '".$db->escape($paiementtype)."'";
|
||||
$param.='&paiementtype='.urlencode($paiementtype);
|
||||
$mode_search = 1;
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT count(*) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
|
||||
@@ -222,7 +223,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql.= " AND b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity = ".$conf->entity;
|
||||
$sql.= $sql_rech;
|
||||
|
||||
|
||||
dol_syslog("account.php count transactions - sql=".$sql, LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
@@ -230,7 +231,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$obj = $db->fetch_object($result);
|
||||
$nbline = $obj->nb;
|
||||
$total_lines = $nbline;
|
||||
|
||||
|
||||
if ($nbline > $viewline ) $limit = $nbline - $viewline ;
|
||||
else $limit = $viewline;
|
||||
|
||||
@@ -240,7 +241,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
if ($page > 0)
|
||||
{
|
||||
$limitsql = $nbline - ($page * $viewline);
|
||||
@@ -253,34 +254,34 @@ if ($id > 0 || ! empty($ref))
|
||||
$limitsql = $nbline;
|
||||
}
|
||||
//print $limitsql.'-'.$page.'-'.$viewline;
|
||||
|
||||
|
||||
// Onglets
|
||||
$head=bank_prepare_head($object);
|
||||
dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object,'ref','',1,'ref');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Label
|
||||
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="3">'.$object->label.'</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
dol_htmloutput_errors($mesg);
|
||||
|
||||
|
||||
/**
|
||||
* Search form
|
||||
*/
|
||||
$param.='&account='.$object->id;
|
||||
|
||||
|
||||
// Define transaction list navigation string
|
||||
$navig='';
|
||||
$navig.='<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="GET">';
|
||||
@@ -289,6 +290,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($limitsql > $viewline) $navig.='<a href="account.php?'.$param.'&page='.($page+1).'">'.img_previous().'</a>';
|
||||
$navig.= $langs->trans("Page")." "; // ' Page ';
|
||||
$navig.='<input type="text" name="negpage" size="1" class="flat" value="'.($nbpage-$page).'">';
|
||||
$navig.='<input type="hidden" name="paiementtype" value="'.$paiementtype.'">';
|
||||
$navig.='<input type="hidden" name="req_nb" value="'.$req_nb.'">';
|
||||
$navig.='<input type="hidden" name="req_desc" value="'.GETPOST("req_desc").'">';
|
||||
$navig.='<input type="hidden" name="req_debit" value="'.GETPOST("req_debit").'">';
|
||||
@@ -303,7 +305,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
$navig.='</form>';
|
||||
//var_dump($navig);
|
||||
|
||||
|
||||
// Confirmation delete
|
||||
if ($action == 'delete')
|
||||
{
|
||||
@@ -311,15 +313,15 @@ if ($id > 0 || ! empty($ref))
|
||||
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete');
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
|
||||
|
||||
// Show title
|
||||
if ($action != 'addline' && $action != 'delete')
|
||||
{
|
||||
print '<tr><td colspan="9" align="right">'.$navig.'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Form to add a transaction with no invoice
|
||||
if ($user->rights->banque->modifier && $action == 'addline')
|
||||
{
|
||||
@@ -328,11 +330,11 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="vline" value="'.$vline.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
|
||||
print '<tr>';
|
||||
print '<td align="left" colspan="10"><b>'.$langs->trans("AddBankRecordLong").'</b></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
print '<td> </td>';
|
||||
@@ -343,7 +345,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align=right>'.$langs->trans("Credit").'</td>';
|
||||
print '<td colspan="2" align="center"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td nowrap="nowrap" colspan="2">';
|
||||
$form->select_date($dateop,'op',0,0,0,'transaction');
|
||||
@@ -366,14 +368,14 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</td></tr>';
|
||||
print "</form>";
|
||||
|
||||
|
||||
print '<tr class="noborder"><td colspan="8"> </td></tr>'."\n";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affiche tableau des transactions bancaires
|
||||
*/
|
||||
|
||||
|
||||
// Ligne de titre tableau des ecritures
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Date").'</td>';
|
||||
@@ -389,19 +391,19 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($object->type != 2 && $object->rappro) print $langs->trans("AccountStatementShort");
|
||||
else print ' ';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param.'" name="search" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="search">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td>';
|
||||
//$filtertype=array('TIP'=>'TIP','PRE'=>'PRE',...)
|
||||
$filtertype='';
|
||||
print $form->select_types_paiements($_REQUEST['paiementtype'],'paiementtype',$filtertype,2,1,1,8);
|
||||
print $form->select_types_paiements($paiementtype,'paiementtype',$filtertype,2,1,1,8);
|
||||
print '</td>';
|
||||
print '<td><input type="text" class="flat" name="req_nb" value="'.$req_nb.'" size="2"></td>';
|
||||
print '<td><input type="text" class="flat" name="req_desc" value="'.GETPOST("req_desc").'" size="24"></td>';
|
||||
@@ -412,13 +414,13 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td align="center" width="40"><input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'"></td>';
|
||||
print "</tr>\n";
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Another solution
|
||||
* create temporary table solde type=heap select amount from llx_bank limit 100 ;
|
||||
* select sum(amount) from solde ;
|
||||
*/
|
||||
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
||||
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type";
|
||||
if ($mode_search)
|
||||
@@ -428,11 +430,11 @@ if ($id > 0 || ! empty($ref))
|
||||
/*
|
||||
if ($mode_search && $conf->adherent->enabled)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
if ($mode_search && $conf->tax->enabled)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
@@ -459,22 +461,22 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql.= $sql_rech;
|
||||
$sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
|
||||
$sql.= $db->plimit($limitsql, 0);
|
||||
|
||||
|
||||
dol_syslog("account.php get transactions - sql=".$sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$now=dol_now();
|
||||
$nows=dol_print_date($now,'%Y%m%d');
|
||||
|
||||
|
||||
//$form->load_cache_types_paiements();
|
||||
//$form->cache_types_paiements
|
||||
|
||||
|
||||
$var=true;
|
||||
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0; $total = 0; $sep = 0;
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
@@ -482,7 +484,7 @@ if ($id > 0 || ! empty($ref))
|
||||
if ($i >= ($nbline - $viewline))
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
|
||||
// Is it a transaction in future ?
|
||||
$dos=dol_print_date($db->jdate($objp->do),'%Y%m%d');
|
||||
//print "dos=".$dos." nows=".$nows;
|
||||
@@ -496,26 +498,25 @@ if ($id > 0 || ! empty($ref))
|
||||
print "<td> </td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
|
||||
print '<td nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
|
||||
|
||||
|
||||
print '<td nowrap="nowrap">'.dol_print_date($db->jdate($objp->dv),"day");
|
||||
print "</td>\n";
|
||||
|
||||
|
||||
// Payment type
|
||||
print "<td nowrap>";
|
||||
$label=($langs->trans("PaymentTypeShort".$objp->fk_type)!="PaymentTypeShort".$objp->fk_type)?$langs->trans("PaymentTypeShort".$objp->fk_type):$objp->fk_type;
|
||||
// $label=$langs->getTradFromKey("PaymentTypeShort".$objp->fk_type);
|
||||
|
||||
|
||||
if ($objp->fk_type == 'SOLD') $label=' ';
|
||||
print $label;
|
||||
print "</td>\n";
|
||||
|
||||
|
||||
// Num
|
||||
print '<td nowrap>'.($objp->num_chq?$objp->num_chq:"")."</td>\n";
|
||||
|
||||
|
||||
// Description
|
||||
print '<td>';
|
||||
// Show generic description
|
||||
@@ -545,7 +546,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
else if ($links[$key]['type']=='company')
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if ($links[$key]['type']=='payment_sc')
|
||||
{
|
||||
@@ -567,11 +568,11 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
else if ($links[$key]['type']=='member')
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else if ($links[$key]['type']=='sc')
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -592,7 +593,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Add third party column
|
||||
print '<td>';
|
||||
foreach($links as $key=>$val)
|
||||
@@ -627,7 +628,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Amount
|
||||
if ($objp->amount < 0)
|
||||
{
|
||||
@@ -637,7 +638,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print '<td> </td><td align="right" nowrap="nowrap"> '.price($objp->amount).'</td>'."\n";
|
||||
}
|
||||
|
||||
|
||||
// Balance
|
||||
if ($action != 'search')
|
||||
{
|
||||
@@ -654,7 +655,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
print '<td align="right">-</td>';
|
||||
}
|
||||
|
||||
|
||||
// Transaction reconciliated or edit link
|
||||
if ($objp->rappro && $object->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
|
||||
{
|
||||
@@ -697,13 +698,13 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
print "</tr>";
|
||||
}
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
// Show total
|
||||
if ($page == 0 && ! $mode_search)
|
||||
{
|
||||
@@ -721,19 +722,19 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
|
||||
|
||||
if ($action != 'delete')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate
|
||||
{
|
||||
if ($user->rights->banque->consolidate)
|
||||
@@ -745,7 +746,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action != 'addline')
|
||||
{
|
||||
if ($user->rights->banque->modifier)
|
||||
@@ -757,10 +758,10 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
else
|
||||
@@ -771,4 +772,4 @@ else
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -255,6 +255,9 @@ $form = new Form($db);
|
||||
*/
|
||||
if ($action == 'create')
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
|
||||
print_fiche_titre($langs->trans("NewTrip"));
|
||||
|
||||
dol_htmloutput_errors($mesg);
|
||||
@@ -295,9 +298,10 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note_public',GETPOST('note_public','alpha'),600,200,'dolibarr_notes','In',false,true,true,ROWS_8,100);
|
||||
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'alpha'), 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100);
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Private note
|
||||
@@ -306,9 +310,10 @@ if ($action == 'create')
|
||||
print '<tr>';
|
||||
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td valign="top" colspan="2">';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note_private',GETPOST('note_private','alpha'),600,200,'dolibarr_notes','In',false,true,true,ROWS_8,100);
|
||||
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'alpha'), 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, 100);
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@@ -332,6 +337,9 @@ else if ($id)
|
||||
|
||||
if ($action == 'edit' && $user->rights->deplacement->creer)
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
|
||||
$soc = new Societe($db);
|
||||
if ($object->socid)
|
||||
{
|
||||
@@ -382,9 +390,10 @@ else if ($id)
|
||||
// Public note
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note_public',$object->note_public,600,200,'dolibarr_notes','In',false,true,true,ROWS_8,'100');
|
||||
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print "</td></tr>";
|
||||
|
||||
// Private note
|
||||
@@ -392,9 +401,10 @@ else if ($id)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td valign="top" colspan="3">';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note_private',$object->note_private,600,200,'dolibarr_notes','In',false,true,true,ROWS_8,'100');
|
||||
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, 600, 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '100');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
@@ -499,8 +509,8 @@ else if ($id)
|
||||
print "</table><br>";
|
||||
|
||||
// Notes
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
|
||||
print '</div>';
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -137,12 +138,7 @@ if (! $mesg)
|
||||
}
|
||||
|
||||
|
||||
$res = $stats->getAverageByMonth($year);
|
||||
$data = array();
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
|
||||
}
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
@@ -162,8 +158,7 @@ $mesg = $px3->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px3->SetData($data);
|
||||
//$i=$startyear;$legend=array();
|
||||
$i=$endyear;$legend=array();
|
||||
$i = $startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
|
||||
@@ -81,10 +81,10 @@ $usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE;
|
||||
|
||||
$object=new Facture($db);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret=$object->fetch($id, $ref);
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
@@ -166,37 +166,37 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fact
|
||||
// Delete line
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$result = $object->deleteline($_GET['lineid'], $user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$ret=$object->fetch($id); // Reload to get new records
|
||||
$result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||
}
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div clas="error">'.$object->error.'</div>';
|
||||
$action='';
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$result = $object->deleteline($_GET['lineid'], $user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
{
|
||||
$ret=$object->fetch($id); // Reload to get new records
|
||||
$result=facture_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'), $hookmanager);
|
||||
}
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg='<div clas="error">'.$object->error.'</div>';
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,6 +265,15 @@ else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setpaymentterm' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->date_lim_reglement=dol_mktime(12,0,0,$_POST['paymenttermmonth'],$_POST['paymenttermday'],$_POST['paymenttermyear']);
|
||||
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement=$object->date;
|
||||
$result=$object->update($user);
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setconditions' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
@@ -317,18 +326,18 @@ else if ($action == 'set_ref_client' && $user->rights->facture->creer)
|
||||
$object->set_ref_client($_POST['ref_client']);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote_public' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
else if ($action == 'setnote_public' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note_public(dol_html_entity_decode(GETPOST('note_public'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
else if ($action == 'setnote' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->update_note(dol_html_entity_decode(GETPOST('note'), ENT_QUOTES));
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
|
||||
// Classify to validated
|
||||
@@ -971,7 +980,11 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
|
||||
$price_base_type = 'HT';
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Define special_code for special lines
|
||||
$special_code=0;
|
||||
//if (empty($_POST['qty'])) $special_code=3; // Options should not exists on invoices
|
||||
|
||||
// Ecrase $pu par celui du produit
|
||||
// Ecrase $desc par celui du produit
|
||||
// Ecrase $txtva par celui du produit
|
||||
// Ecrase $base_price_type par celui du produit
|
||||
@@ -1090,7 +1103,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
|
||||
$pu_ttc,
|
||||
$type,
|
||||
-1,
|
||||
0,
|
||||
$special_code,
|
||||
'',
|
||||
0,
|
||||
GETPOST('fk_parent_line')
|
||||
@@ -1162,6 +1175,11 @@ else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['sa
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")).'</div>';
|
||||
$result = -1 ;
|
||||
}
|
||||
|
||||
// Define special_code for special lines
|
||||
$special_code=0;
|
||||
//if (empty($_POST['qty'])) $special_code=3; // Option should not exists onto invoices
|
||||
|
||||
// Check minimum price
|
||||
if (GETPOST('productid'))
|
||||
{
|
||||
@@ -1513,64 +1531,81 @@ else if ($action == 'builddoc') // En get ou en post
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file')
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->facture->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('file')).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
if ($action == 'addcontact' && $user->rights->facture->creer)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->facture->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
$result = $result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$mesg = '<div class="error">'.$object->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut' && $user->rights->facture->creer)
|
||||
{
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$result=$object->swapContactStatus(GETPOST('ligne'));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
|
||||
exit;
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2808,22 +2843,22 @@ else
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/contact/class/contact.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
$formcompany= new FormCompany($db);
|
||||
|
||||
$blocname = 'contacts';
|
||||
$title = $langs->trans('ContactsAddresses');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php');
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -146,20 +146,20 @@ class FactureRec extends Facture
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$result_insert = $this->addline(
|
||||
$this->id,
|
||||
$facsrc->lines[$i]->desc,
|
||||
$facsrc->lines[$i]->subprice,
|
||||
$facsrc->lines[$i]->qty,
|
||||
$facsrc->lines[$i]->tva_tx,
|
||||
$facsrc->lines[$i]->fk_product,
|
||||
$facsrc->lines[$i]->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
'',
|
||||
0,
|
||||
$facsrc->lines[$i]->product_type,
|
||||
$facsrc->lines[$i]->rang,
|
||||
$facsrc->lines[$i]->special_code
|
||||
$this->id,
|
||||
$facsrc->lines[$i]->desc,
|
||||
$facsrc->lines[$i]->subprice,
|
||||
$facsrc->lines[$i]->qty,
|
||||
$facsrc->lines[$i]->tva_tx,
|
||||
$facsrc->lines[$i]->fk_product,
|
||||
$facsrc->lines[$i]->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
'',
|
||||
0,
|
||||
$facsrc->lines[$i]->product_type,
|
||||
$facsrc->lines[$i]->rang,
|
||||
$facsrc->lines[$i]->special_code
|
||||
);
|
||||
|
||||
if ($result_insert < 0)
|
||||
|
||||
@@ -256,30 +256,30 @@ class Facture extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
|
||||
// TODO mutualiser
|
||||
if ($origin == 'commande')
|
||||
{
|
||||
// On recupere les differents contact interne et externe
|
||||
// TODO mutualiser
|
||||
if ($origin == 'commande')
|
||||
{
|
||||
// On recupere les differents contact interne et externe
|
||||
$order = new Commande($this->db);
|
||||
$order->id = $origin_id;
|
||||
|
||||
// On recupere le commercial suivi propale
|
||||
$order->id = $origin_id;
|
||||
|
||||
// On recupere le commercial suivi propale
|
||||
$this->userid = $order->getIdcontact('internal', 'SALESREPFOLL');
|
||||
|
||||
if ($this->userid)
|
||||
{
|
||||
//On passe le commercial suivi commande en commercial suivi paiement
|
||||
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
|
||||
}
|
||||
|
||||
// On recupere le contact client facturation commande
|
||||
$this->contactid = $order->getIdcontact('external', 'BILLING');
|
||||
|
||||
if ($this->contactid)
|
||||
{
|
||||
//On passe le contact client facturation commande en contact client facturation
|
||||
$this->add_contact($this->contactid[0], 'BILLING', 'external');
|
||||
}
|
||||
|
||||
if ($this->userid)
|
||||
{
|
||||
//On passe le commercial suivi commande en commercial suivi paiement
|
||||
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
|
||||
}
|
||||
|
||||
// On recupere le contact client facturation commande
|
||||
$this->contactid = $order->getIdcontact('external', 'BILLING');
|
||||
|
||||
if ($this->contactid)
|
||||
{
|
||||
//On passe le contact client facturation commande en contact client facturation
|
||||
$this->add_contact($this->contactid[0], 'BILLING', 'external');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,7 +349,7 @@ class Facture extends CommonObject
|
||||
$this->lines[$i]->fk_code_ventilation,
|
||||
$this->lines[$i]->info_bits,
|
||||
$this->lines[$i]->fk_remise_except,
|
||||
'HT',
|
||||
'HT',
|
||||
0,
|
||||
$this->lines[$i]->product_type,
|
||||
$this->lines[$i]->rang,
|
||||
@@ -400,7 +400,13 @@ class Facture extends CommonObject
|
||||
$localtax2_tx,
|
||||
$_facrec->lines[$i]->fk_product,
|
||||
$_facrec->lines[$i]->remise_percent,
|
||||
'','',0,0,'','HT',0,
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
0,
|
||||
'',
|
||||
'HT',
|
||||
0,
|
||||
$_facrec->lines[$i]->product_type,
|
||||
$_facrec->lines[$i]->rang,
|
||||
$_facrec->lines[$i]->special_code
|
||||
@@ -674,11 +680,11 @@ class Facture extends CommonObject
|
||||
$this->origin = $object->element;
|
||||
$this->origin_id = $object->id;
|
||||
|
||||
// Possibility to add external linked objects with hooks
|
||||
$this->linked_objects[$this->origin] = $this->origin_id;
|
||||
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
|
||||
{
|
||||
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
|
||||
// Possibility to add external linked objects with hooks
|
||||
$this->linked_objects[$this->origin] = $this->origin_id;
|
||||
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
|
||||
{
|
||||
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
|
||||
}
|
||||
|
||||
$ret = $this->create($user);
|
||||
@@ -1237,34 +1243,34 @@ class Facture extends CommonObject
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// On efface le repertoire de pdf provisoire
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->facture->dir_output)
|
||||
{
|
||||
$dir = $conf->facture->dir_output . "/" . $ref;
|
||||
$file = $conf->facture->dir_output . "/" . $ref . "/" . $ref . ".pdf";
|
||||
if (file_exists($file)) // We must delete all files before deleting directory
|
||||
{
|
||||
// On efface le repertoire de pdf provisoire
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->facture->dir_output)
|
||||
{
|
||||
$dir = $conf->facture->dir_output . "/" . $ref;
|
||||
$file = $conf->facture->dir_output . "/" . $ref . "/" . $ref . ".pdf";
|
||||
if (file_exists($file)) // We must delete all files before deleting directory
|
||||
{
|
||||
$ret=dol_delete_preview($this);
|
||||
|
||||
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (file_exists($dir))
|
||||
{
|
||||
if (! dol_delete_dir_recursive($dir)) // For remove dir and meta
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteFile",$file);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (file_exists($dir))
|
||||
{
|
||||
if (! dol_delete_dir_recursive($dir)) // For remove dir and meta
|
||||
{
|
||||
$this->error=$langs->trans("ErrorCanNotDeleteDir",$dir);
|
||||
$this->db->rollback();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@@ -1708,7 +1714,7 @@ class Facture extends CommonObject
|
||||
|
||||
dol_syslog("Rename ok");
|
||||
// Suppression ancien fichier PDF dans nouveau rep
|
||||
dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'.*');
|
||||
dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'*.*');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1720,6 +1726,7 @@ class Facture extends CommonObject
|
||||
$this->ref = $num;
|
||||
$this->facnumber=$num;
|
||||
$this->statut=1;
|
||||
$this->brouillon=0;
|
||||
$this->date_validation=$now;
|
||||
}
|
||||
|
||||
@@ -1795,7 +1802,7 @@ class Facture extends CommonObject
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
// We decrease stock for product
|
||||
if ($this->type == 2) $result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
|
||||
else $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref));
|
||||
else $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceBackToDraftInDolibarr",$this->ref)); // we use 0 for price, to not change the weighted average value
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2010,9 +2017,10 @@ class Facture extends CommonObject
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int $fk_parent_line ???
|
||||
* @param int $skip_update_total ???
|
||||
* @param int $special_code Special code
|
||||
* @return int < 0 if KO, > 0 if OK
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0)
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0, $special_code=0)
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php');
|
||||
|
||||
@@ -2093,6 +2101,7 @@ class Facture extends CommonObject
|
||||
$this->line->product_type = $type;
|
||||
$this->line->fk_parent_line = $fk_parent_line;
|
||||
$this->line->skip_update_total = $skip_update_total;
|
||||
$this->line->special_code = $special_code;
|
||||
|
||||
// A ne plus utiliser
|
||||
//$this->line->price=$price;
|
||||
@@ -3625,6 +3634,7 @@ class FactureLigne
|
||||
//if (empty($this->remise)) $this->remise=0;
|
||||
if (empty($this->remise_percent)) $this->remise_percent=0;
|
||||
if (empty($this->info_bits)) $this->info_bits=0;
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->product_type)) $this->product_type=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
|
||||
@@ -3652,6 +3662,7 @@ class FactureLigne
|
||||
else { $sql.=',date_end=null'; }
|
||||
$sql.= ",product_type=".$this->product_type;
|
||||
$sql.= ",info_bits='".$this->info_bits."'";
|
||||
$sql.= ",special_code='".$this->special_code."'";
|
||||
if (empty($this->skip_update_total))
|
||||
{
|
||||
$sql.= ",total_ht=".price2num($this->total_ht)."";
|
||||
|
||||
@@ -35,7 +35,7 @@ $langs->load("companies");
|
||||
|
||||
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
|
||||
$ref = GETPOST('ref');
|
||||
$socid=GETPOST('socid','int');
|
||||
$socid=GETPOST('socid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
@@ -166,9 +166,9 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines
|
||||
print '<br>';
|
||||
|
||||
// Contacts lines
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php');
|
||||
}
|
||||
else
|
||||
|
||||
@@ -43,6 +43,13 @@ $confirm = GETPOST('confirm');
|
||||
$id = GETPOST('facid','int');
|
||||
$ref = GETPOST('ref');
|
||||
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id)
|
||||
{
|
||||
@@ -125,7 +132,9 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
$upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
dol_delete_file($file,0,0,0,$object);
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ if ($resql)
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print "<tr ".$bc[$var].">";
|
||||
$classname = "impayee";
|
||||
|
||||
print '<td nowrap="nowrap">';
|
||||
@@ -380,6 +380,7 @@ if ($resql)
|
||||
print '<td align="right"><b>'.price($total_paid).'</b></td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php');
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
|
||||
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
$action=GETPOST('action','alpha');
|
||||
|
||||
// Security check
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -148,12 +149,7 @@ if (! $mesg)
|
||||
}
|
||||
|
||||
|
||||
$res = $stats->getAverageByMonth($year);
|
||||
$data = array();
|
||||
for ($i = 1 ; $i < 13 ; $i++)
|
||||
{
|
||||
$data[$i-1] = array(ucfirst(dol_substr(dol_print_date(dol_mktime(12,0,0,$i,1,$year),"%b"),0,3)), $res[$i]);
|
||||
}
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
{
|
||||
@@ -173,8 +169,7 @@ $mesg = $px3->isGraphKo();
|
||||
if (! $mesg)
|
||||
{
|
||||
$px3->SetData($data);
|
||||
//$i=$startyear;$legend=array();
|
||||
$i=$endyear;$legend=array();
|
||||
$i = $startyear;$legend=array();
|
||||
while ($i <= $endyear)
|
||||
{
|
||||
$legend[]=$i;
|
||||
@@ -219,34 +214,37 @@ complete_head_from_modules($conf,$langs,$object,$head,$h,$type);
|
||||
|
||||
dol_fiche_head($head,'byyear',$langs->trans("Statistics"));
|
||||
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
if (empty($socid))
|
||||
{
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// Company
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'/'.$langs->trans("SalesRepresentative").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;
|
||||
arsort($arrayyears);
|
||||
print $form->selectarray('year',$arrayyears,$year,0);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr height="24">';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -33,9 +34,9 @@ $langs->load("compta");
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'societe&facture');
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
@@ -147,7 +148,7 @@ print "<tr class=\"liste_titre\">";
|
||||
print "<td>".$langs->trans("Date")."</td>";
|
||||
print "<td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
|
||||
print "<td>".$langs->trans("Account")."</td>";
|
||||
print "<t><td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
|
||||
print "<td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
@@ -201,7 +202,7 @@ foreach ($tabfac as $key => $val)
|
||||
foreach ($tabttc[$key] as $k => $mt)
|
||||
{
|
||||
print "<td>".$k."</td><td>".$langs->trans("ThirdParty")."</td>";
|
||||
print '<td align="right">'.($mt<0?-price(-$mt):'')."</td>";
|
||||
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
|
||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||
}
|
||||
print "</tr>";
|
||||
@@ -216,4 +217,4 @@ print "</table>";
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -34,9 +35,9 @@ $langs->load("compta");
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'societe&facture');
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
@@ -86,16 +87,21 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
|
||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
|
||||
$idpays = $p[0];
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client , fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
||||
$sql.= " p.accountancy_code_sell, s.code_compta , ct.accountancy_code";
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
|
||||
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
|
||||
$sql.= " ct.accountancy_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facturedet fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture f ON f.rowid = fd.fk_facture";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " WHERE f.fk_statut > 0 AND f.entity = ".$conf->entity;
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
$sql.= " AND fd.product_type IN (0,1)";
|
||||
if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
$sql .= " order by f.rowid";
|
||||
$sql.= " ORDER BY f.rowid";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@@ -150,7 +156,7 @@ print "<tr class=\"liste_titre\">";
|
||||
//print "<td>".$langs->trans("JournalNum")."</td>";
|
||||
print "<td>".$langs->trans("Date")."</td><td>".$langs->trans("Piece").' ('.$langs->trans("InvoiceRef").")</td>";
|
||||
print "<td>".$langs->trans("Account")."</td>";
|
||||
print "<t><td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
|
||||
print "<td>".$langs->trans("Type")."</td><td align='right'>".$langs->trans("Debit")."</td><td align='right'>".$langs->trans("Credit")."</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
$var=true;
|
||||
@@ -209,4 +215,4 @@ print "</table>";
|
||||
// End of page
|
||||
$db->close();
|
||||
llxFooter();
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -263,7 +263,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
{
|
||||
var code = $("#selectpaiementcode option:selected").val();
|
||||
|
||||
if (code == \'CHQ\')
|
||||
if (code == \'CHQ\' || code == \'VIR\')
|
||||
{
|
||||
$(\'.fieldrequireddyn\').addClass(\'fieldrequired\');
|
||||
if ($(\'#fieldchqemetteur\').val() == \'\')
|
||||
@@ -442,12 +442,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.type, ';
|
||||
$sql.= ' f.datef as df';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= ' WHERE f.fk_soc = '.$facture->socid;
|
||||
$sql.= ' WHERE f.entity = '.$conf->entity;
|
||||
$sql.= ' AND f.fk_soc = '.$facture->socid;
|
||||
$sql.= ' AND f.paye = 0';
|
||||
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
|
||||
if ($facture->type != 2)
|
||||
{
|
||||
$sql .= ' AND type in (0,1,3)'; // Standard invoice, replacement, deposit
|
||||
$sql .= ' AND type IN (0,1,3)'; // Standard invoice, replacement, deposit
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -119,7 +119,7 @@ class RemiseCheque extends CommonObject
|
||||
* @param array $toRemise array with cheques to remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user, $account_id, $limit=40, $toRemise)
|
||||
function create($user, $account_id, $limit, $toRemise)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
@@ -216,6 +216,21 @@ if ($action == 'builddoc' && $user->rights->banque->cheque)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove file in doc form
|
||||
else if ($action == 'remove_file' && $user->rights->banque->cheque)
|
||||
{
|
||||
$remisecheque = new RemiseCheque($db);
|
||||
if ($remisecheque->fetch($_GET["id"]) > 0)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
$langs->load("other");
|
||||
|
||||
$file=$dir.get_exdir($remisecheque->number,2,1) . GETPOST('file');
|
||||
$ret=dol_delete_file($file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -36,8 +36,7 @@ $action=GETPOST("action");
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', $langs->trans("SocialContribution"), '', 'charges');
|
||||
|
||||
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -262,8 +262,12 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
function solde($year = 0)
|
||||
{
|
||||
$sql = "SELECT sum(f.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f WHERE paye = 0";
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT SUM(f.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as f";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND paye = 0";
|
||||
|
||||
if ($year) {
|
||||
$sql .= " AND f.datev >= '$y-01-01' AND f.datev <= '$y-12-31' ";
|
||||
@@ -300,8 +304,8 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
function set_paid($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales";
|
||||
$sql.= " set paye=1";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
|
||||
$sql.= " paye = 1";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$return = $this->db->query($sql);
|
||||
if ($return) return 1;
|
||||
|
||||
@@ -35,7 +35,7 @@ $action=GETPOST("action");
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'tax', $langs->trans("SocialContribution"), '', 'charges');
|
||||
$result = restrictedArea($user, 'tax', $id, 'chargesociales','charges');
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -806,8 +806,12 @@ class Contact extends CommonObject
|
||||
$sql = "SELECT count(mc.email) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'";
|
||||
$sql.= " AND mc.statut=1"; // -1 erreur, 0 non envoye, 1 envoye avec succes
|
||||
$sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes
|
||||
|
||||
dol_syslog(get_class($this)."::getNbOfEMailings sql=".$sql, LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
@@ -227,11 +227,9 @@ class Contrat extends CommonObject
|
||||
* Close all lines of a contract
|
||||
*
|
||||
* @param User $user Object User making action
|
||||
* @param Translate $langs Object Lang
|
||||
* @param Conf $conf Object Conf
|
||||
* @return void
|
||||
*/
|
||||
function cloture($user,$langs='',$conf='')
|
||||
function cloture($user)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
@@ -258,7 +256,7 @@ class Contrat extends CommonObject
|
||||
|
||||
if ($this->statut == 0)
|
||||
{
|
||||
$result=$this->validate($user,$langs,$conf);
|
||||
$result=$this->validate($user);
|
||||
if ($result < 0) $ok=false;
|
||||
}
|
||||
|
||||
@@ -277,12 +275,12 @@ class Contrat extends CommonObject
|
||||
* Validate a contract
|
||||
*
|
||||
* @param User $user Objet User
|
||||
* @param Translate $langs Environnement langue de l'utilisateur
|
||||
* @param Conf $conf Environnement de configuration lors de l'operation
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function validate($user,$langs,$conf)
|
||||
function validate($user)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$error=0;
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET statut = 1";
|
||||
@@ -354,7 +352,8 @@ class Contrat extends CommonObject
|
||||
$this->note_private = $result["note_private"];
|
||||
$this->note_public = $result["note_public"];
|
||||
|
||||
$this->fk_projet = $result["fk_projet"];
|
||||
$this->fk_projet = $result["fk_projet"]; // deprecated
|
||||
$this->fk_project = $result["fk_projet"];
|
||||
|
||||
$this->socid = $result["fk_soc"];
|
||||
$this->fk_soc = $result["fk_soc"];
|
||||
@@ -443,7 +442,7 @@ class Contrat extends CommonObject
|
||||
$line->statut = $objp->statut;
|
||||
$line->remise_percent = $objp->remise_percent;
|
||||
$line->price_ht = $objp->price_ht;
|
||||
$line->price = $objp->price; // For backward compatibility
|
||||
$line->price = $objp->price_ht; // For backward compatibility
|
||||
$line->total_ht = $objp->total_ht;
|
||||
$line->total_tva = $objp->total_tva;
|
||||
$line->total_localtax1 = $objp->total_localtax1;
|
||||
@@ -697,12 +696,12 @@ class Contrat extends CommonObject
|
||||
* Supprime l'objet de la base
|
||||
*
|
||||
* @param User $user Utilisateur qui supprime
|
||||
* @param Translate $langs Environnement langue de l'utilisateur
|
||||
* @param Conf $conf Environnement de configuration lors de l'operation
|
||||
* @return int < 0 si erreur, > 0 si ok
|
||||
*/
|
||||
function delete($user,$langs='',$conf='')
|
||||
function delete($user)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
@@ -791,15 +790,39 @@ class Contrat extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTRACT_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// We remove directory
|
||||
$ref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->contrat->dir_output)
|
||||
{
|
||||
$dir = $conf->contrat->dir_output . "/" . $ref;
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$res=@dol_delete_dir_recursive($dir);
|
||||
if (! $res)
|
||||
{
|
||||
$this->error='ErrorFailToDeleteDir';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('CONTRACT_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -34,9 +34,19 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php");
|
||||
|
||||
$langs->load("other");
|
||||
$langs->load("products");
|
||||
$langs->load("contracts");
|
||||
|
||||
if (!$user->rights->contrat->lire)
|
||||
accessforbidden();
|
||||
$action = GETPOST('action','alpha');
|
||||
$confirm = GETPOST('confirm','alpha');
|
||||
$id = GETPOST('id','int');
|
||||
$ref = GETPOST('ref','alpha');
|
||||
|
||||
$mesg='';
|
||||
if (isset($_SESSION['DolMessage']))
|
||||
{
|
||||
$mesg=$_SESSION['DolMessage'];
|
||||
unset($_SESSION['DolMessage']);
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
@@ -45,6 +55,7 @@ if ($user->societe_id > 0)
|
||||
$action='';
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
$result = restrictedArea($user, 'contrat', $id);
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
@@ -58,10 +69,14 @@ if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
|
||||
|
||||
$contrat = new Contrat($db);
|
||||
$contrat->fetch($_GET["id"]);
|
||||
$object = new Contrat($db);
|
||||
$object->fetch($id, $ref);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($contrat->ref);
|
||||
$upload_dir = $conf->contrat->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$modulepart='contract';
|
||||
|
||||
|
||||
@@ -105,6 +120,21 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$langs->load("other");
|
||||
|
||||
$file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
$_SESSION['DolMessage'] = '<div class="ok">'.$langs->trans("FileWasRemoved",GETPOST('urlfile')).'</div>';
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
@@ -115,24 +145,9 @@ $form = new Form($db);
|
||||
llxHeader("","",$langs->trans("CardProduct".$product->type));
|
||||
|
||||
|
||||
if ($contrat->id)
|
||||
if ($object->id)
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($contrat->societe->id);
|
||||
|
||||
if ( $error_msg )
|
||||
{
|
||||
echo '<div class="error">'.$error_msg.'</div><br>';
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'delete')
|
||||
{
|
||||
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$result=dol_delete_file($file);
|
||||
//if ($result >= 0) $mesg=$langs->trans("FileWasRemoced");
|
||||
}
|
||||
|
||||
$head=contract_prepare_head($contrat, $user);
|
||||
$head=contract_prepare_head($object, $user);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("Contract"), 0, 'contract');
|
||||
|
||||
@@ -149,27 +164,38 @@ if ($contrat->id)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Reference
|
||||
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'.$contrat->ref.'</td></tr>';
|
||||
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'.$object->ref.'</td></tr>';
|
||||
|
||||
// Societe
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td>';
|
||||
print '<td colspan="3">'.$soc->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_htmloutput_mesg($mesg,$mesgs);
|
||||
|
||||
/*
|
||||
* Confirmation suppression fichier
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?id='.$id.'&urlfile='.urlencode(GETPOST("urlfile")), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', 0, 1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/contrat/document.php?id='.$contrat->id,'',0,0,$user->rights->contrat->creer,50,$object);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/contrat/document.php?id='.$object->id,'',0,0,$user->rights->contrat->creer,50,$object);
|
||||
|
||||
|
||||
// List of document
|
||||
$param='&id='.$contrat->id;
|
||||
$formfile->list_of_documents($filearray,$contrat,'contract',$param);
|
||||
$param='&id='.$object->id;
|
||||
$formfile->list_of_documents($filearray,$object,'contract',$param);
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/price.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/modules/contract/modules_contract.php");
|
||||
if ($conf->produit->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
if ($conf->produit->enabled || $conf->service->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/projet/class/project.class.php");
|
||||
if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php");
|
||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT."/core/lib/project.lib.php");
|
||||
@@ -415,20 +415,21 @@ else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->validate($user,$langs,$conf);
|
||||
$result = $object->validate($user);
|
||||
}
|
||||
|
||||
// Close all lines
|
||||
else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->cloture($user,$langs,$conf);
|
||||
$result = $object->cloture($user);
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result=$object->delete($user,$langs,$conf);
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
$result=$object->delete($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@@ -34,8 +34,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't nee
|
||||
|
||||
|
||||
require("../../main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/fileupload.class.php");
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
@@ -47,380 +46,29 @@ $fk_element = GETPOST('fk_element','int');
|
||||
$element = GETPOST('element','alpha');
|
||||
|
||||
|
||||
/**
|
||||
* \file htdocs/core/ajax/fileupload.php
|
||||
* \brief This class is used to manage file upload using ajax
|
||||
*/
|
||||
class UploadHandler
|
||||
{
|
||||
private $_options;
|
||||
private $_fk_element;
|
||||
private $_element;
|
||||
private $_element_ref;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $options Options array
|
||||
* @param int $fk_element fk_element
|
||||
* @param string $element element
|
||||
* @param string $element_ref element ref
|
||||
*/
|
||||
function __construct($options=null,$fk_element=null,$element=null)
|
||||
{
|
||||
|
||||
global $db, $conf;
|
||||
global $object;
|
||||
|
||||
$this->_fk_element=$fk_element;
|
||||
$this->_element=$element;
|
||||
|
||||
$pathname=$filename=$element;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
|
||||
{
|
||||
$pathname = $regs[1];
|
||||
$filename = $regs[2];
|
||||
}
|
||||
|
||||
// For compatibility
|
||||
if ($element == 'propal') {
|
||||
$pathname = 'comm/propal'; $filename = 'propal';
|
||||
}
|
||||
if ($element == 'commande') {
|
||||
$pathname = $filename = 'commande';
|
||||
}
|
||||
if ($element == 'facture') {
|
||||
$pathname = 'compta/facture'; $filename = 'facture';
|
||||
}
|
||||
|
||||
dol_include_once('/'.$pathname.'/class/'.$filename.'.class.php');
|
||||
|
||||
$classname = ucfirst($filename);
|
||||
$object = new $classname($db);
|
||||
|
||||
$object->fetch($fk_element);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$this->_options = array(
|
||||
'script_url' => $_SERVER['PHP_SELF'],
|
||||
'upload_dir' => $conf->$element->dir_output . '/' . $object->ref . '/',
|
||||
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object->ref.'/',
|
||||
'param_name' => 'files',
|
||||
// The php.ini settings upload_max_filesize and post_max_size
|
||||
// take precedence over the following max_file_size setting:
|
||||
'max_file_size' => null,
|
||||
'min_file_size' => 1,
|
||||
'accept_file_types' => '/.+$/i',
|
||||
'max_number_of_files' => null,
|
||||
'discard_aborted_uploads' => true,
|
||||
'image_versions' => array(
|
||||
// Uncomment the following version to restrict the size of
|
||||
// uploaded images. You can also add additional versions with
|
||||
// their own upload directories:
|
||||
/*
|
||||
'small' => array(
|
||||
'upload_dir' => dirname(__FILE__).'/files/',
|
||||
'upload_url' => dirname($_SERVER['PHP_SELF']).'/files/'
|
||||
),
|
||||
*/
|
||||
'thumbs' => array(
|
||||
'upload_dir' => $conf->$element->dir_output . '/' . $object->ref . '/thumbs/',
|
||||
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object->ref.'/thumbs/'
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($options) {
|
||||
$this->_options = array_merge_recursive($this->_options, $options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param string $file_name Filename
|
||||
* @return stdClass|NULL
|
||||
*/
|
||||
private function get_file_object($file_name)
|
||||
{
|
||||
$file_path = $this->_options['upload_dir'].$file_name;
|
||||
if (is_file($file_path) && $file_name[0] !== '.')
|
||||
{
|
||||
$file = new stdClass();
|
||||
$file->name = $file_name;
|
||||
$file->mime = dol_mimetype($file_name,'',2);
|
||||
$file->size = filesize($file_path);
|
||||
$file->url = $this->_options['upload_url'].rawurlencode($file->name);
|
||||
foreach($this->_options['image_versions'] as $version => $options) {
|
||||
if (is_file($options['upload_dir'].$file_name)) {
|
||||
$tmp=explode('.',$file->name);
|
||||
$file->{$version.'_url'} = $options['upload_url'].rawurlencode($tmp[0].'_mini.'.$tmp[1]);
|
||||
}
|
||||
}
|
||||
$file->delete_url = $this->_options['script_url']
|
||||
.'?file='.rawurlencode($file->name).'&fk_element='.$this->_fk_element.'&element='.$this->_element;
|
||||
$file->delete_type = 'DELETE';
|
||||
return $file;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function get_file_objects()
|
||||
{
|
||||
return array_values(array_filter(array_map(array($this, 'get_file_object'), scandir($this->_options['upload_dir']))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create thumbs
|
||||
*
|
||||
* @param string $file_name Filename
|
||||
* @param string $options is array('max_width', 'max_height')
|
||||
* @return void
|
||||
*/
|
||||
private function create_scaled_image($file_name, $options)
|
||||
{
|
||||
global $maxwidthmini, $maxheightmini;
|
||||
$file_path = $this->_options['upload_dir'].$file_name;
|
||||
$new_file_path = $options['upload_dir'].$file_name;
|
||||
|
||||
if (dol_mkdir($options['upload_dir']) >= 0)
|
||||
{
|
||||
list($img_width, $img_height) = @getimagesize($file_path);
|
||||
if (!$img_width || !$img_height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$res=vignette($file_path,$maxwidthmini,$maxheightmini,'_mini');
|
||||
|
||||
//return $success;
|
||||
if (preg_match('/error/i',$res)) return false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param string $uploaded_file Uploade file
|
||||
* @param string $file File
|
||||
* @param string $error Error
|
||||
* @return unknown|string
|
||||
*/
|
||||
private function has_error($uploaded_file, $file, $error)
|
||||
{
|
||||
if ($error) {
|
||||
return $error;
|
||||
}
|
||||
if (!preg_match($this->_options['accept_file_types'], $file->name)) {
|
||||
return 'acceptFileTypes';
|
||||
}
|
||||
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
||||
$file_size = filesize($uploaded_file);
|
||||
} else {
|
||||
$file_size = $_SERVER['CONTENT_LENGTH'];
|
||||
}
|
||||
if ($this->_options['max_file_size'] && (
|
||||
$file_size > $this->_options['max_file_size'] ||
|
||||
$file->size > $this->_options['max_file_size'])
|
||||
) {
|
||||
return 'maxFileSize';
|
||||
}
|
||||
if ($this->_options['min_file_size'] &&
|
||||
$file_size < $this->_options['min_file_size']) {
|
||||
return 'minFileSize';
|
||||
}
|
||||
if (is_int($this->_options['max_number_of_files']) && (
|
||||
count($this->get_file_objects()) >= $this->_options['max_number_of_files'])
|
||||
) {
|
||||
return 'maxNumberOfFiles';
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param string $uploaded_file Uploade file
|
||||
* @param string $name Name
|
||||
* @param int $size Size
|
||||
* @param string $type Type
|
||||
* @param string $error Error
|
||||
* @return stdClass
|
||||
*/
|
||||
private function handle_file_upload($uploaded_file, $name, $size, $type, $error)
|
||||
{
|
||||
$file = new stdClass();
|
||||
$file->name = basename(stripslashes($name));
|
||||
$file->mime = dol_mimetype($file->name,'',2);
|
||||
$file->size = intval($size);
|
||||
$file->type = $type;
|
||||
$error = $this->has_error($uploaded_file, $file, $error);
|
||||
if (!$error && $file->name && dol_mkdir($this->_options['upload_dir']) >= 0) {
|
||||
if ($file->name[0] === '.') {
|
||||
$file->name = substr($file->name, 1);
|
||||
}
|
||||
$file_path = $this->_options['upload_dir'].$file->name;
|
||||
$append_file = is_file($file_path) && $file->size > filesize($file_path);
|
||||
clearstatcache();
|
||||
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
||||
// multipart/formdata uploads (POST method uploads)
|
||||
if ($append_file) {
|
||||
file_put_contents(
|
||||
$file_path,
|
||||
fopen($uploaded_file, 'r'),
|
||||
FILE_APPEND
|
||||
);
|
||||
} else {
|
||||
dol_move_uploaded_file($uploaded_file, $file_path, 1);
|
||||
}
|
||||
} else {
|
||||
// Non-multipart uploads (PUT method support)
|
||||
file_put_contents(
|
||||
$file_path,
|
||||
fopen('php://input', 'r'),
|
||||
$append_file ? FILE_APPEND : 0
|
||||
);
|
||||
}
|
||||
$file_size = filesize($file_path);
|
||||
if ($file_size === $file->size) {
|
||||
$file->url = $this->_options['upload_url'].rawurlencode($file->name);
|
||||
foreach($this->_options['image_versions'] as $version => $options)
|
||||
{
|
||||
if ($this->create_scaled_image($file->name, $options))
|
||||
{
|
||||
$tmp=explode('.',$file->name);
|
||||
$file->{$version.'_url'} = $options['upload_url'].rawurlencode($tmp[0].'_mini.'.$tmp[1]);
|
||||
}
|
||||
}
|
||||
} else if ($this->_options['discard_aborted_uploads']) {
|
||||
unlink($file_path);
|
||||
$file->error = 'abort';
|
||||
}
|
||||
$file->size = $file_size;
|
||||
$file->delete_url = $this->_options['script_url']
|
||||
.'?file='.rawurlencode($file->name).'&fk_element='.$this->_fk_element.'&element='.$this->_element;
|
||||
$file->delete_type = 'DELETE';
|
||||
} else {
|
||||
$file->error = $error;
|
||||
}
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$file_name = isset($_REQUEST['file']) ?
|
||||
basename(stripslashes($_REQUEST['file'])) : null;
|
||||
if ($file_name) {
|
||||
$info = $this->get_file_object($file_name);
|
||||
} else {
|
||||
$info = $this->get_file_objects();
|
||||
}
|
||||
header('Content-type: application/json');
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function post()
|
||||
{
|
||||
$upload = isset($_FILES[$this->_options['param_name']]) ?
|
||||
$_FILES[$this->_options['param_name']] : array(
|
||||
'tmp_name' => null,
|
||||
'name' => null,
|
||||
'size' => null,
|
||||
'type' => null,
|
||||
'error' => null
|
||||
);
|
||||
$info = array();
|
||||
if (is_array($upload['tmp_name'])) {
|
||||
foreach ($upload['tmp_name'] as $index => $value) {
|
||||
$info[] = $this->handle_file_upload(
|
||||
$upload['tmp_name'][$index],
|
||||
isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index],
|
||||
isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index],
|
||||
isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index],
|
||||
$upload['error'][$index]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$info[] = $this->handle_file_upload(
|
||||
$upload['tmp_name'],
|
||||
isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'],
|
||||
isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'],
|
||||
isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'],
|
||||
$upload['error']
|
||||
);
|
||||
}
|
||||
header('Vary: Accept');
|
||||
if (isset($_SERVER['HTTP_ACCEPT']) &&
|
||||
(strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) {
|
||||
header('Content-type: application/json');
|
||||
} else {
|
||||
header('Content-type: text/plain');
|
||||
}
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete uploaded file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$file_name = isset($_REQUEST['file']) ?
|
||||
basename(stripslashes($_REQUEST['file'])) : null;
|
||||
$file_path = $this->_options['upload_dir'].$file_name;
|
||||
$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
|
||||
if ($success) {
|
||||
foreach($this->_options['image_versions'] as $version => $options) {
|
||||
$file = $options['upload_dir'].$file_name;
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
header('Content-type: application/json');
|
||||
echo json_encode($success);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$upload_handler = new UploadHandler(null,$fk_element,$element);
|
||||
$upload_handler = new FileUpload(null,$fk_element,$element);
|
||||
|
||||
header('Pragma: no-cache');
|
||||
header('Cache-Control: private, no-cache');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Content-Disposition: inline; filename="files.json"');
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
|
||||
header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
|
||||
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
case 'OPTIONS':
|
||||
break;
|
||||
case 'HEAD':
|
||||
case 'GET':
|
||||
$upload_handler->get();
|
||||
break;
|
||||
case 'POST':
|
||||
$upload_handler->post();
|
||||
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
|
||||
$upload_handler->delete();
|
||||
} else {
|
||||
$upload_handler->post();
|
||||
}
|
||||
break;
|
||||
case 'DELETE':
|
||||
$upload_handler->delete();
|
||||
@@ -430,7 +78,6 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
?>
|
||||
@@ -90,7 +90,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
|
||||
$module = $subelement = $ext_element;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
|
||||
{
|
||||
$module = $regs[1];
|
||||
$module = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
|
||||
@@ -50,11 +50,11 @@ if ((isset($_POST['roworder']) && ! empty($_POST['roworder'])) && (isset($_POST[
|
||||
if (! empty($value)) $newroworder[] = $value;
|
||||
}
|
||||
|
||||
dol_syslog("AjaxRow roworder=".GETPOST('roworder','alpha',2)." fk_element=".GETPOST('fk_element','int',2), LOG_DEBUG);
|
||||
dol_syslog("AjaxRow roworder=".GETPOST('roworder','alpha',2)." fk_element=".GETPOST('fk_element','alpha',2), LOG_DEBUG);
|
||||
|
||||
$row=new GenericObject($db);
|
||||
$row->table_element_line = GETPOST('table_element_line','alpha',2);
|
||||
$row->fk_element = GETPOST('fk_element','int',2);
|
||||
$row->fk_element = GETPOST('fk_element','alpha',2);
|
||||
$row->id = GETPOST('element_id','int',2);
|
||||
$result=$row->line_ajaxorder($newroworder);
|
||||
$result=$row->line_order(true);
|
||||
|
||||
@@ -30,9 +30,9 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
require('../../main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/genericobject.class.php");
|
||||
|
||||
$field = GETPOST('field','alpha',2);
|
||||
$element = GETPOST('element','alpha',2);
|
||||
$table_element = GETPOST('table_element','alpha',2);
|
||||
$field = GETPOST('field','alpha',2);
|
||||
$element = GETPOST('element','alpha',2);
|
||||
$table_element = GETPOST('table_element','alpha',2);
|
||||
$fk_element = GETPOST('fk_element','alpha',2);
|
||||
|
||||
/*
|
||||
@@ -132,11 +132,11 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($
|
||||
}
|
||||
else
|
||||
{
|
||||
$module = $subelement = $ext_element;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
|
||||
{
|
||||
$module = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
$module = $subelement = $ext_element;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs))
|
||||
{
|
||||
$module = $regs[1];
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
dol_include_once('/'.$module.'/class/actions_'.$subelement.'.class.php');
|
||||
|
||||
@@ -49,12 +49,12 @@ if (! empty($id) && ! empty($action) && ! empty($htmlname))
|
||||
|
||||
$soc->fetch($id);
|
||||
|
||||
$return=array();
|
||||
|
||||
$return['value'] = $form->load_tva('tva_tx','',$soc,$mysoc,0,0,'',true);
|
||||
$return['num'] = $form->num;
|
||||
$return['error'] = $form->error;
|
||||
|
||||
$return=array();
|
||||
|
||||
$return['value'] = $form->load_tva('tva_tx','',$soc,$mysoc,0,0,'',true);
|
||||
$return['num'] = $form->num;
|
||||
$return['error'] = $form->error;
|
||||
|
||||
echo json_encode($return);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class box_contracts extends ModeleBoxes
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$langs->load("contracts");
|
||||
$langs->load("boxes");
|
||||
|
||||
$this->boxlabel=$langs->transnoentitiesnoconv("BoxLastContracts");
|
||||
}
|
||||
|
||||
@@ -73,7 +73,8 @@ class box_members extends ModeleBoxes
|
||||
|
||||
if ($user->rights->societe->lire)
|
||||
{
|
||||
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
|
||||
$sql = "SELECT a.rowid, a.nom as lastname, a.prenom as firstname, a.societe, a.fk_soc,";
|
||||
$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
|
||||
$sql.= " t.cotisation";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql.= " WHERE a.entity = ".$conf->entity;
|
||||
@@ -97,6 +98,14 @@ class box_members extends ModeleBoxes
|
||||
$memberstatic->lastname=$objp->lastname;
|
||||
$memberstatic->firstname=$objp->firstname;
|
||||
|
||||
if (! empty($objp->fk_soc)) {
|
||||
$memberstatic->socid = $objp->fk_soc;
|
||||
$memberstatic->fetch_thirdparty();
|
||||
$memberstatic->name=$memberstatic->thirdparty->name;
|
||||
} else {
|
||||
$memberstatic->name=$objp->company;
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
'url' => DOL_URL_ROOT."/adherents/fiche.php?rowid=".$objp->rowid);
|
||||
|
||||
@@ -103,11 +103,15 @@ class CMailFile
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// We define end of line (RFC 822bis section 2.3)
|
||||
// We define end of line (RFC 821).
|
||||
$this->eol="\r\n";
|
||||
// eol2 is for header fields to manage bugged MTA with option MAIN_FIX_FOR_BUGGED_MTA
|
||||
$this->eol2=$this->eol;
|
||||
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) $this->eol2="\n";
|
||||
// We define end of line for header fields (RFC 822bis section 2.3 says header must contains \r\n).
|
||||
$this->eol2="\r\n";
|
||||
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
||||
{
|
||||
$this->eol="\n";
|
||||
$this->eol2="\n";
|
||||
}
|
||||
|
||||
// On defini mixed_boundary
|
||||
$this->mixed_boundary = "multipart_x." . time() . ".x_boundary";
|
||||
@@ -494,6 +498,7 @@ class CMailFile
|
||||
/**
|
||||
* Write content of a SMTP request into a dump file (mode = all)
|
||||
* Used for debugging.
|
||||
* Note that to see full SMTP protocol, you can use tcpdump -w /tmp/smtp -s 2000 port 25"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@@ -593,7 +598,11 @@ class CMailFile
|
||||
|
||||
// Sender
|
||||
//$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2;
|
||||
$out.= "From: ".$this->getValidAddress($this->addr_from,3,1).$this->eol2;
|
||||
$out.= "From: ".$this->getValidAddress($this->addr_from,3,1).$this->eol2;
|
||||
if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA))
|
||||
{
|
||||
$out.= "To: ".$this->getValidAddress($this->addr_to,0,1).$this->eol2;
|
||||
}
|
||||
$out.= "Return-Path: ".$this->getValidAddress($this->addr_from,0,1).$this->eol2;
|
||||
if (isset($this->reply_to) && $this->reply_to) $out.= "Reply-To: ".$this->getValidAddress($this->reply_to,2).$this->eol2;
|
||||
if (isset($this->errors_to) && $this->errors_to) $out.= "Errors-To: ".$this->getValidAddress($this->errors_to,2).$this->eol2;
|
||||
@@ -688,7 +697,11 @@ class CMailFile
|
||||
|
||||
// Make RFC821 Compliant, replace bare linefeeds
|
||||
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent);
|
||||
|
||||
if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
|
||||
{
|
||||
$strContent = preg_replace("/\r\n/si", "\n", $strContent);
|
||||
}
|
||||
|
||||
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged
|
||||
$strContent = rtrim(wordwrap($strContent));
|
||||
|
||||
@@ -1013,4 +1026,4 @@ class CMailFile
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -140,6 +140,26 @@ abstract class CommonDocGenerator
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rect pdf
|
||||
*
|
||||
* @param PDF $pdf Object PDF
|
||||
* @param float $x Abscissa of first point
|
||||
* @param float $y Ordinate of first point
|
||||
* @param float $l ??
|
||||
* @param float $h ??
|
||||
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
|
||||
* @param int $hidebottom Hide bottom
|
||||
* @return void
|
||||
*/
|
||||
function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0)
|
||||
{
|
||||
if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y);
|
||||
$pdf->line($x+$l, $y, $x+$l, $y+$h);
|
||||
if (empty($hidebottom)) $pdf->line($x+$l, $y+$h, $x, $y+$h);
|
||||
$pdf->line($x, $y+$h, $x, $y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -865,93 +865,93 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the payments methods
|
||||
*
|
||||
* @param int $id Id of new payment method
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function setPaymentMethods($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
{
|
||||
// TODO uniformize field name
|
||||
$fieldname = 'fk_mode_reglement';
|
||||
if ($this->element == 'societe') $fieldname = 'mode_reglement';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.$id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
/**
|
||||
* Change the payments methods
|
||||
*
|
||||
* @param int $id Id of new payment method
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function setPaymentMethods($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
{
|
||||
// TODO uniformize field name
|
||||
$fieldname = 'fk_mode_reglement';
|
||||
if ($this->element == 'societe') $fieldname = 'mode_reglement';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.$id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->mode_reglement_id = $id;
|
||||
$this->mode_reglement = $id; // for compatibility
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
$this->mode_reglement = $id; // for compatibility
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentMethods, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the payments terms
|
||||
*
|
||||
* @param int $id Id of new payment terms
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function setPaymentTerms($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
/**
|
||||
* Change the payments terms
|
||||
*
|
||||
* @param int $id Id of new payment terms
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function setPaymentTerms($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
{
|
||||
// TODO uniformize field name
|
||||
$fieldname = 'fk_cond_reglement';
|
||||
if ($this->element == 'societe') $fieldname = 'cond_reglement';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.$id;
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.$id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->cond_reglement_id = $id;
|
||||
$this->cond_reglement = $id; // for compatibility
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
$this->cond_reglement = $id; // for compatibility
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setPaymentTerms, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define delivery address
|
||||
*
|
||||
* @param int $id Address id
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function setDeliveryAddress($id)
|
||||
/**
|
||||
* Define delivery address
|
||||
*
|
||||
* @param int $id Address id
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
function setDeliveryAddress($id)
|
||||
{
|
||||
$fieldname = 'fk_adresse_livraison';
|
||||
if ($this->element == 'delivery' || $this->element == 'shipping') $fieldname = 'fk_address';
|
||||
@@ -962,14 +962,14 @@ abstract class CommonObject
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->fk_delivery_address = $id;
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog(get_class($this).'::setDeliveryAddress Erreur '.$sql.' - '.$this->error);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1854,18 +1854,18 @@ abstract class CommonObject
|
||||
$sql.= " WHERE rowid=".$elementId;
|
||||
|
||||
dol_syslog(get_class($this)."::setStatut sql=".$sql, LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->db->commit();
|
||||
$this->statut = $status;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->statut = $status;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2148,35 +2148,35 @@ abstract class CommonObject
|
||||
return $nb;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Set extra parameters
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setExtraParameters()
|
||||
* @return void
|
||||
*/
|
||||
function setExtraParameters()
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$extraparams = (! empty($this->extraparams) ? json_encode($this->extraparams) : null);
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET extraparams = ".(! empty($extraparams) ? "'".$this->db->escape($extraparams)."'" : "null");
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setExtraParameters sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::setExtraParameters ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
dol_syslog(get_class($this)."::setExtraParameters sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::setExtraParameters ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ class Conf
|
||||
{
|
||||
$modulename=strtolower($reg[1]);
|
||||
if ($modulename == 'propale') $modulename='propal';
|
||||
$this->$modulename=(object) array();
|
||||
if (! isset($this->$modulename) || ! is_object($this->$modulename)) $this->$modulename=(object) array();
|
||||
$this->$modulename->enabled=true;
|
||||
$this->modules[]=$modulename; // Add this module in list of enabled modules
|
||||
}
|
||||
@@ -213,28 +213,28 @@ class Conf
|
||||
//var_dump($this->modules);
|
||||
//var_dump($this->modules_parts);
|
||||
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
{
|
||||
global $mc;
|
||||
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||
if ($ret) $mc = new ActionsMulticompany($db);
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
{
|
||||
global $mc;
|
||||
$ret = @dol_include_once('/multicompany/class/actions_multicompany.class.php');
|
||||
if ($ret) $mc = new ActionsMulticompany($db);
|
||||
}
|
||||
|
||||
// Second or others levels object
|
||||
$this->propal->cloture = (object) array();
|
||||
$this->propal->cloture = (object) array();
|
||||
$this->propal->facturation = (object) array();
|
||||
$this->commande->client = (object) array();
|
||||
$this->commande->client = (object) array();
|
||||
$this->commande->fournisseur = (object) array();
|
||||
$this->facture->client = (object) array();
|
||||
$this->facture->client = (object) array();
|
||||
$this->facture->fournisseur = (object) array();
|
||||
$this->fournisseur->commande = (object) array();
|
||||
$this->fournisseur->commande = (object) array();
|
||||
$this->fournisseur->facture = (object) array();
|
||||
$this->contrat->services = (object) array();
|
||||
$this->contrat->services->inactifs = (object) array();
|
||||
$this->contrat->services = (object) array();
|
||||
$this->contrat->services->inactifs = (object) array();
|
||||
$this->contrat->services->expires = (object) array();
|
||||
$this->adherent->cotisation = (object) array();
|
||||
$this->bank->rappro = (object) array();
|
||||
$this->bank->rappro = (object) array();
|
||||
$this->bank->cheque = (object) array();
|
||||
|
||||
// Clean some variables
|
||||
@@ -268,7 +268,7 @@ class Conf
|
||||
// Define default dir_output and dir_temp for directories of modules
|
||||
foreach($this->modules as $module)
|
||||
{
|
||||
$this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
|
||||
$this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
|
||||
$this->$module->multidir_temp = array($this->entity => $rootfordata."/".$module."/temp");
|
||||
// For backward compatibility
|
||||
$this->$module->dir_output = $rootfordata."/".$module;
|
||||
@@ -284,15 +284,15 @@ class Conf
|
||||
$this->admin->dir_temp=$rootfordata.'/admin/temp';
|
||||
|
||||
// For user storage
|
||||
$this->user->multidir_output = array($this->entity => $rootfordata."/users");
|
||||
$this->user->multidir_output = array($this->entity => $rootfordata."/users");
|
||||
$this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp");
|
||||
// For backward compatibility
|
||||
$this->user->dir_output=$rootforuser."/users";
|
||||
$this->user->dir_temp=$rootforuser."/users/temp";
|
||||
|
||||
// For propal storage
|
||||
$this->propal->dir_output=$rootforuser."/propale";
|
||||
$this->propal->dir_temp=$rootforuser."/propale/temp";
|
||||
// For propal storage
|
||||
$this->propal->dir_output=$rootfordata."/propale";
|
||||
$this->propal->dir_temp=$rootfordata."/propale/temp";
|
||||
|
||||
// Exception: Some dir are not the name of module. So we keep exception here
|
||||
// for backward compatibility.
|
||||
@@ -314,9 +314,9 @@ class Conf
|
||||
$this->service->multidir_output=array($this->entity => $rootfordata."/produit");
|
||||
$this->service->multidir_temp =array($this->entity => $rootfordata."/produit/temp");
|
||||
// For backward compatibility
|
||||
$this->product->dir_output=$rootfordata."/produit";
|
||||
$this->product->dir_temp =$rootfordata."/produit/temp";
|
||||
$this->service->dir_output=$rootfordata."/produit";
|
||||
$this->product->dir_output=$rootfordata."/produit";
|
||||
$this->product->dir_temp =$rootfordata."/produit/temp";
|
||||
$this->service->dir_output=$rootfordata."/produit";
|
||||
$this->service->dir_temp =$rootfordata."/produit/temp";
|
||||
|
||||
// Module contrat
|
||||
@@ -436,10 +436,10 @@ class Conf
|
||||
if ($this->top_menu == 'eldy.php') $this->top_menu='eldy_backoffice.php';
|
||||
elseif ($this->top_menu == 'rodolphe.php') $this->top_menu='eldy_backoffice.php';
|
||||
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
// Object $mc
|
||||
if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled))
|
||||
{
|
||||
if (is_object($mc)) $mc->setValues($this);
|
||||
if (is_object($mc)) $mc->setValues($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
580
htdocs/core/class/fileupload.class.php
Normal file
580
htdocs/core/class/fileupload.class.php
Normal file
@@ -0,0 +1,580 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/ajax/fileupload.php
|
||||
* \brief File to return Ajax response on file upload
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/lib/images.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/fileupload.class.php
|
||||
* \brief This class is used to manage file upload using ajax
|
||||
*/
|
||||
class FileUpload
|
||||
{
|
||||
protected $_options;
|
||||
protected $_fk_element;
|
||||
protected $_element;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $options Options array
|
||||
* @param int $fk_element fk_element
|
||||
* @param string $element element
|
||||
*/
|
||||
function __construct($options=null,$fk_element=null,$element=null)
|
||||
{
|
||||
global $db, $conf;
|
||||
global $object;
|
||||
|
||||
$this->_fk_element=$fk_element;
|
||||
$this->_element=$element;
|
||||
|
||||
$pathname=$filename=$element;
|
||||
if (preg_match('/^([^_]+)_([^_]+)/i',$element,$regs))
|
||||
{
|
||||
$pathname = $regs[1];
|
||||
$filename = $regs[2];
|
||||
}
|
||||
|
||||
// For compatibility
|
||||
if ($element == 'propal') {
|
||||
$pathname = 'comm/propal';
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
}
|
||||
elseif ($element == 'facture') {
|
||||
$pathname = 'compta/facture';
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
}
|
||||
elseif ($element == 'project') {
|
||||
$element = $pathname = 'projet';
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
}
|
||||
elseif ($element == 'fichinter') {
|
||||
$element='ficheinter';
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
}
|
||||
elseif ($element == 'order_supplier') {
|
||||
$pathname = 'fourn'; $filename='fournisseur.commande';
|
||||
$dir_output=$conf->fournisseur->commande->dir_output;
|
||||
}
|
||||
elseif ($element == 'invoice_supplier') {
|
||||
$pathname = 'fourn'; $filename='fournisseur.facture';
|
||||
$dir_output=$conf->fournisseur->facture->dir_output;
|
||||
} else {
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
}
|
||||
|
||||
dol_include_once('/'.$pathname.'/class/'.$filename.'.class.php');
|
||||
|
||||
$classname = ucfirst($filename);
|
||||
|
||||
if ($element == 'order_supplier') {
|
||||
$classname = 'CommandeFournisseur';
|
||||
} elseif ($element == 'invoice_supplier') {
|
||||
$classname = 'FactureFournisseur';
|
||||
}
|
||||
|
||||
$object = new $classname($db);
|
||||
|
||||
$object->fetch($fk_element);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$object_ref = dol_sanitizeFileName($object->ref);
|
||||
if ($element == 'invoice_supplier') {
|
||||
$object_ref = get_exdir($object->id, 2) . $object_ref;
|
||||
}
|
||||
|
||||
$this->_options = array(
|
||||
'script_url' => $_SERVER['PHP_SELF'],
|
||||
'upload_dir' => $dir_output . '/' . $object_ref . '/',
|
||||
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object_ref.'/',
|
||||
'param_name' => 'files',
|
||||
// Set the following option to 'POST', if your server does not support
|
||||
// DELETE requests. This is a parameter sent to the client:
|
||||
'delete_type' => 'DELETE',
|
||||
// The php.ini settings upload_max_filesize and post_max_size
|
||||
// take precedence over the following max_file_size setting:
|
||||
'max_file_size' => null,
|
||||
'min_file_size' => 1,
|
||||
'accept_file_types' => '/.+$/i',
|
||||
// The maximum number of files for the upload directory:
|
||||
'max_number_of_files' => null,
|
||||
// Image resolution restrictions:
|
||||
'max_width' => null,
|
||||
'max_height' => null,
|
||||
'min_width' => 1,
|
||||
'min_height' => 1,
|
||||
// Set the following option to false to enable resumable uploads:
|
||||
'discard_aborted_uploads' => true,
|
||||
'image_versions' => array(
|
||||
// Uncomment the following version to restrict the size of
|
||||
// uploaded images. You can also add additional versions with
|
||||
// their own upload directories:
|
||||
/*
|
||||
'large' => array(
|
||||
'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/files/',
|
||||
'upload_url' => $this->getFullUrl().'/files/',
|
||||
'max_width' => 1920,
|
||||
'max_height' => 1200,
|
||||
'jpeg_quality' => 95
|
||||
),
|
||||
*/
|
||||
'thumbnail' => array(
|
||||
'upload_dir' => $dir_output . '/' . $object_ref . '/thumbs/',
|
||||
'upload_url' => DOL_URL_ROOT.'/document.php?modulepart='.$element.'&attachment=1&file=/'.$object_ref.'/thumbs/',
|
||||
'max_width' => 80,
|
||||
'max_height' => 80
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($options) {
|
||||
$this->_options = array_replace_recursive($this->_options, $options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getFullUrl
|
||||
*
|
||||
* @return string Full url
|
||||
*/
|
||||
protected function getFullUrl()
|
||||
{
|
||||
$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
|
||||
return
|
||||
($https ? 'https://' : 'http://').
|
||||
(!empty($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
|
||||
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
|
||||
($https && $_SERVER['SERVER_PORT'] === 443 ||
|
||||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
|
||||
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set delete url
|
||||
*
|
||||
* @param string $file File
|
||||
* @return void
|
||||
*/
|
||||
protected function set_file_delete_url($file)
|
||||
{
|
||||
$file->delete_url = $this->_options['script_url']
|
||||
.'?file='.rawurlencode($file->name).'&fk_element='.$this->_fk_element.'&element='.$this->_element;
|
||||
$file->delete_type = $this->_options['delete_type'];
|
||||
if ($file->delete_type !== 'DELETE') {
|
||||
$file->delete_url .= '&_method=DELETE';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param string $file_name Filename
|
||||
* @return stdClass|NULL
|
||||
*/
|
||||
protected function get_file_object($file_name)
|
||||
{
|
||||
$file_path = $this->_options['upload_dir'].$file_name;
|
||||
if (is_file($file_path) && $file_name[0] !== '.')
|
||||
{
|
||||
$file = new stdClass();
|
||||
$file->name = $file_name;
|
||||
$file->mime = dol_mimetype($file_name,'',2);
|
||||
$file->size = filesize($file_path);
|
||||
$file->url = $this->_options['upload_url'].rawurlencode($file->name);
|
||||
foreach($this->_options['image_versions'] as $version => $options) {
|
||||
if (is_file($options['upload_dir'].$file_name)) {
|
||||
$tmp=explode('.',$file->name);
|
||||
$file->{$version.'_url'} = $options['upload_url'].rawurlencode($tmp[0].'_mini.'.$tmp[1]);
|
||||
}
|
||||
}
|
||||
$this->set_file_delete_url($file);
|
||||
return $file;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function get_file_objects()
|
||||
{
|
||||
return array_values(array_filter(array_map(array($this, 'get_file_object'), scandir($this->_options['upload_dir']))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create thumbs
|
||||
*
|
||||
* @param string $file_name Filename
|
||||
* @param string $options is array('max_width', 'max_height')
|
||||
* @return void
|
||||
*/
|
||||
protected function create_scaled_image($file_name, $options)
|
||||
{
|
||||
global $maxwidthmini, $maxheightmini;
|
||||
|
||||
$file_path = $this->_options['upload_dir'].$file_name;
|
||||
$new_file_path = $options['upload_dir'].$file_name;
|
||||
|
||||
if (dol_mkdir($options['upload_dir']) >= 0)
|
||||
{
|
||||
list($img_width, $img_height) = @getimagesize($file_path);
|
||||
if (!$img_width || !$img_height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$res=vignette($file_path,$maxwidthmini,$maxheightmini,'_mini');
|
||||
|
||||
//return $success;
|
||||
if (preg_match('/error/i',$res)) return false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param string $uploaded_file Uploade file
|
||||
* @param string $file File
|
||||
* @param string $error Error
|
||||
* @param string $index Index
|
||||
* @return unknown|string
|
||||
*/
|
||||
protected function validate($uploaded_file, $file, $error, $index)
|
||||
{
|
||||
if ($error) {
|
||||
$file->error = $error;
|
||||
return false;
|
||||
}
|
||||
if (!$file->name) {
|
||||
$file->error = 'missingFileName';
|
||||
return false;
|
||||
}
|
||||
if (!preg_match($this->_options['accept_file_types'], $file->name)) {
|
||||
$file->error = 'acceptFileTypes';
|
||||
return false;
|
||||
}
|
||||
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
||||
$file_size = filesize($uploaded_file);
|
||||
} else {
|
||||
$file_size = $_SERVER['CONTENT_LENGTH'];
|
||||
}
|
||||
if ($this->_options['max_file_size'] && (
|
||||
$file_size > $this->_options['max_file_size'] ||
|
||||
$file->size > $this->_options['max_file_size'])
|
||||
) {
|
||||
$file->error = 'maxFileSize';
|
||||
return false;
|
||||
}
|
||||
if ($this->_options['min_file_size'] &&
|
||||
$file_size < $this->_options['min_file_size']) {
|
||||
$file->error = 'minFileSize';
|
||||
return false;
|
||||
}
|
||||
if (is_int($this->_options['max_number_of_files']) && (
|
||||
count($this->get_file_objects()) >= $this->_options['max_number_of_files'])
|
||||
) {
|
||||
$file->error = 'maxNumberOfFiles';
|
||||
return false;
|
||||
}
|
||||
list($img_width, $img_height) = @getimagesize($uploaded_file);
|
||||
if (is_int($img_width)) {
|
||||
if ($this->_options['max_width'] && $img_width > $this->_options['max_width'] ||
|
||||
$this->_options['max_height'] && $img_height > $this->_options['max_height']) {
|
||||
$file->error = 'maxResolution';
|
||||
return false;
|
||||
}
|
||||
if ($this->_options['min_width'] && $img_width < $this->_options['min_width'] ||
|
||||
$this->_options['min_height'] && $img_height < $this->_options['min_height']) {
|
||||
$file->error = 'minResolution';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param unknown_type $matches
|
||||
*/
|
||||
protected function upcount_name_callback($matches) {
|
||||
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
|
||||
$ext = isset($matches[2]) ? $matches[2] : '';
|
||||
return ' ('.$index.')'.$ext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param unknown_type $name
|
||||
*/
|
||||
protected function upcount_name($name) {
|
||||
return preg_replace_callback(
|
||||
'/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
|
||||
array($this, 'upcount_name_callback'),
|
||||
$name,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @param string $index
|
||||
* @return string Trimed string
|
||||
*/
|
||||
protected function trim_file_name($name, $type, $index) {
|
||||
// Remove path information and dots around the filename, to prevent uploading
|
||||
// into different directories or replacing hidden system files.
|
||||
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
||||
$file_name = trim(basename(stripslashes($name)), ".\x00..\x20");
|
||||
// Add missing file extension for known image types:
|
||||
if (strpos($file_name, '.') === false &&
|
||||
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
|
||||
$file_name .= '.'.$matches[1];
|
||||
}
|
||||
if ($this->_options['discard_aborted_uploads']) {
|
||||
while(is_file($this->_options['upload_dir'].$file_name)) {
|
||||
$file_name = $this->upcount_name($file_name);
|
||||
}
|
||||
}
|
||||
return $file_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param unknown_type $file
|
||||
* @param unknown_type $index
|
||||
*/
|
||||
protected function handle_form_data($file, $index) {
|
||||
// Handle form data, e.g. $_REQUEST['description'][$index]
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param unknown_type $file_path
|
||||
*/
|
||||
protected function orient_image($file_path) {
|
||||
$exif = @exif_read_data($file_path);
|
||||
if ($exif === false) {
|
||||
return false;
|
||||
}
|
||||
$orientation = intval(@$exif['Orientation']);
|
||||
if (!in_array($orientation, array(3, 6, 8))) {
|
||||
return false;
|
||||
}
|
||||
$image = @imagecreatefromjpeg($file_path);
|
||||
switch ($orientation) {
|
||||
case 3:
|
||||
$image = @imagerotate($image, 180, 0);
|
||||
break;
|
||||
case 6:
|
||||
$image = @imagerotate($image, 270, 0);
|
||||
break;
|
||||
case 8:
|
||||
$image = @imagerotate($image, 90, 0);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
$success = imagejpeg($image, $file_path);
|
||||
// Free up memory (imagedestroy does not delete files):
|
||||
@imagedestroy($image);
|
||||
return $success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here ...
|
||||
*
|
||||
* @param string $uploaded_file Uploade file
|
||||
* @param string $name Name
|
||||
* @param int $size Size
|
||||
* @param string $type Type
|
||||
* @param string $error Error
|
||||
* @param string $index Index
|
||||
* @return stdClass
|
||||
*/
|
||||
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index)
|
||||
{
|
||||
$file = new stdClass();
|
||||
$file->name = $this->trim_file_name($name, $type, $index);
|
||||
$file->mime = dol_mimetype($file->name,'',2);
|
||||
$file->size = intval($size);
|
||||
$file->type = $type;
|
||||
if ($this->validate($uploaded_file, $file, $error, $index) && dol_mkdir($this->_options['upload_dir']) >= 0) {
|
||||
$this->handle_form_data($file, $index);
|
||||
$file_path = $this->_options['upload_dir'].$file->name;
|
||||
$append_file = !$this->_options['discard_aborted_uploads'] && is_file($file_path) && $file->size > filesize($file_path);
|
||||
clearstatcache();
|
||||
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
||||
// multipart/formdata uploads (POST method uploads)
|
||||
if ($append_file) {
|
||||
file_put_contents(
|
||||
$file_path,
|
||||
fopen($uploaded_file, 'r'),
|
||||
FILE_APPEND
|
||||
);
|
||||
} else {
|
||||
dol_move_uploaded_file($uploaded_file, $file_path, 1);
|
||||
}
|
||||
} else {
|
||||
// Non-multipart uploads (PUT method support)
|
||||
file_put_contents(
|
||||
$file_path,
|
||||
fopen('php://input', 'r'),
|
||||
$append_file ? FILE_APPEND : 0
|
||||
);
|
||||
}
|
||||
$file_size = filesize($file_path);
|
||||
if ($file_size === $file->size) {
|
||||
$file->url = $this->_options['upload_url'].rawurlencode($file->name);
|
||||
foreach($this->_options['image_versions'] as $version => $options)
|
||||
{
|
||||
if ($this->create_scaled_image($file->name, $options))
|
||||
{
|
||||
$tmp=explode('.',$file->name);
|
||||
$file->{$version.'_url'} = $options['upload_url'].rawurlencode($tmp[0].'_mini.'.$tmp[1]);
|
||||
}
|
||||
}
|
||||
} else if ($this->_options['discard_aborted_uploads']) {
|
||||
unlink($file_path);
|
||||
$file->error = 'abort';
|
||||
}
|
||||
$file->size = $file_size;
|
||||
$this->set_file_delete_url($file);
|
||||
}
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
$file_name = isset($_REQUEST['file']) ?
|
||||
basename(stripslashes($_REQUEST['file'])) : null;
|
||||
if ($file_name) {
|
||||
$info = $this->get_file_object($file_name);
|
||||
} else {
|
||||
$info = $this->get_file_objects();
|
||||
}
|
||||
header('Content-type: application/json');
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function post()
|
||||
{
|
||||
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
|
||||
return $this->delete();
|
||||
}
|
||||
$upload = isset($_FILES[$this->_options['param_name']]) ?
|
||||
$_FILES[$this->_options['param_name']] : null;
|
||||
$info = array();
|
||||
if ($upload && is_array($upload['tmp_name'])) {
|
||||
// param_name is an array identifier like "files[]",
|
||||
// $_FILES is a multi-dimensional array:
|
||||
foreach ($upload['tmp_name'] as $index => $value) {
|
||||
$info[] = $this->handle_file_upload(
|
||||
$upload['tmp_name'][$index],
|
||||
isset($_SERVER['HTTP_X_FILE_NAME']) ? $_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index],
|
||||
isset($_SERVER['HTTP_X_FILE_SIZE']) ? $_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index],
|
||||
isset($_SERVER['HTTP_X_FILE_TYPE']) ? $_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index],
|
||||
$upload['error'][$index],
|
||||
$index
|
||||
);
|
||||
}
|
||||
} elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) {
|
||||
// param_name is a single object identifier like "file",
|
||||
// $_FILES is a one-dimensional array:
|
||||
$info[] = $this->handle_file_upload(
|
||||
isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
|
||||
isset($_SERVER['HTTP_X_FILE_NAME']) ?
|
||||
$_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ?
|
||||
$upload['name'] : null),
|
||||
isset($_SERVER['HTTP_X_FILE_SIZE']) ?
|
||||
$_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ?
|
||||
$upload['size'] : null),
|
||||
isset($_SERVER['HTTP_X_FILE_TYPE']) ?
|
||||
$_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ?
|
||||
$upload['type'] : null),
|
||||
isset($upload['error']) ? $upload['error'] : null
|
||||
);
|
||||
}
|
||||
header('Vary: Accept');
|
||||
$json = json_encode($info);
|
||||
$redirect = isset($_REQUEST['redirect']) ?
|
||||
stripslashes($_REQUEST['redirect']) : null;
|
||||
if ($redirect) {
|
||||
header('Location: '.sprintf($redirect, rawurlencode($json)));
|
||||
return;
|
||||
}
|
||||
if (isset($_SERVER['HTTP_ACCEPT']) &&
|
||||
(strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) {
|
||||
header('Content-type: application/json');
|
||||
} else {
|
||||
header('Content-type: text/plain');
|
||||
}
|
||||
echo $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete uploaded file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$file_name = isset($_REQUEST['file']) ?
|
||||
basename(stripslashes($_REQUEST['file'])) : null;
|
||||
$file_path = $this->_options['upload_dir'].$file_name;
|
||||
$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
|
||||
if ($success) {
|
||||
foreach($this->_options['image_versions'] as $version => $options) {
|
||||
$file = $options['upload_dir'].$file_name;
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
header('Content-type: application/json');
|
||||
echo json_encode($success);
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,6 @@ class HookManager
|
||||
|
||||
/**
|
||||
* Init array this->hooks with instantiated action controlers.
|
||||
*
|
||||
* First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS
|
||||
* with value 'nameofcontext1:nameofcontext2:...' into $this->const of module descriptor file.
|
||||
* This make conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...))
|
||||
|
||||
@@ -285,12 +285,12 @@ class Form
|
||||
if (! empty($tmp[2])) $savemethod=$tmp[2];
|
||||
if (! empty($tmp[3])) $button_only=true;
|
||||
}
|
||||
else if (preg_match('/^textarea/',$inputType))
|
||||
{
|
||||
$tmp=explode(':',$inputType);
|
||||
else if (preg_match('/^textarea/',$inputType))
|
||||
{
|
||||
$tmp=explode(':',$inputType);
|
||||
$inputType=$tmp[0];
|
||||
if (! empty($tmp[1])) $rows=$tmp[1];
|
||||
if (! empty($tmp[2])) $cols=$tmp[2];
|
||||
if (! empty($tmp[1])) $rows=$tmp[1];
|
||||
if (! empty($tmp[2])) $cols=$tmp[2];
|
||||
}
|
||||
else if (preg_match('/^ckeditor/',$inputType))
|
||||
{
|
||||
@@ -669,6 +669,7 @@ class Form
|
||||
$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.= " WHERE s.entity IN (".getEntity('societe', 1).")";
|
||||
if (! empty($user->societe_id)) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
if ($filter) $sql.= " AND ".$filter;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " ORDER BY nom ASC";
|
||||
@@ -790,20 +791,20 @@ class Form
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of all contacts (for a third party or all)
|
||||
*
|
||||
* @param int $socid Id ot third party or 0 for all
|
||||
* @param string $selected Id contact pre-selectionne
|
||||
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value
|
||||
* @param string $exclude List of contacts id to exclude
|
||||
* @param string $limitto Disable answers that are not id in this array list
|
||||
* @param string $showfunction Add function into label
|
||||
* @param string $moreclass Add more class to class style
|
||||
* @return int <0 if KO, Nb of contact in list if OK
|
||||
*/
|
||||
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='')
|
||||
/**
|
||||
* Return list of all contacts (for a third party or all)
|
||||
*
|
||||
* @param int $socid Id ot third party or 0 for all
|
||||
* @param string $selected Id contact pre-selectionne
|
||||
* @param string $htmlname Name of HTML field ('none' for a not editable field)
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value
|
||||
* @param string $exclude List of contacts id to exclude
|
||||
* @param string $limitto Disable answers that are not id in this array list
|
||||
* @param string $showfunction Add function into label
|
||||
* @param string $moreclass Add more class to class style
|
||||
* @return int <0 if KO, Nb of contact in list if OK
|
||||
*/
|
||||
function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='')
|
||||
{
|
||||
print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass);
|
||||
return $this->num;
|
||||
@@ -929,7 +930,7 @@ class Form
|
||||
* @param int $force_entity Possibility to force entity
|
||||
* @return void
|
||||
*/
|
||||
function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0)
|
||||
function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=false)
|
||||
{
|
||||
print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity);
|
||||
}
|
||||
@@ -947,7 +948,7 @@ class Form
|
||||
* @param int $force_entity Possibility to force entity
|
||||
* @return string HTML select string
|
||||
*/
|
||||
function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=0)
|
||||
function select_dolusers($selected='',$htmlname='userid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -962,22 +963,32 @@ class Form
|
||||
$out='';
|
||||
|
||||
// On recherche les utilisateurs
|
||||
$sql = "SELECT u.rowid, u.name as lastname, u.firstname, u.login, u.admin, u.entity";
|
||||
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
$sql = "SELECT DISTINCT u.rowid, u.name as lastname, u.firstname, u.login, u.admin, u.entity";
|
||||
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$sql.= ", e.label";
|
||||
}
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX ."user as u";
|
||||
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."entity as e on e.rowid=u.entity";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX ."entity as e ON e.rowid=u.entity";
|
||||
if ($force_entity) $sql.= " WHERE u.entity IN (0,".$force_entity.")";
|
||||
else $sql.= " WHERE u.entity IS NOT NULL";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
if (! empty($conf->multicompany->transverse_mode))
|
||||
{
|
||||
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql.= " WHERE ug.fk_user = u.rowid";
|
||||
$sql.= " AND ug.entity = ".$conf->entity;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
}
|
||||
}
|
||||
if (! empty($user->societe_id)) $sql.= " AND u.fk_societe = ".$user->societe_id;
|
||||
if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')";
|
||||
if (is_array($include) && $includeUsers) $sql.= " AND u.rowid IN ('".$includeUsers."')";
|
||||
$sql.= " ORDER BY u.name ASC";
|
||||
@@ -1020,7 +1031,7 @@ class Form
|
||||
}
|
||||
$out.= $userstatic->getFullName($langs);
|
||||
|
||||
if(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
if ($obj->admin && ! $obj->entity) $out.=" (".$langs->trans("AllEntities").")";
|
||||
else $out.=" (".$obj->label.")";
|
||||
@@ -1359,10 +1370,10 @@ class Form
|
||||
$sql.= " s.nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid";
|
||||
$sql.= " WHERE p.entity IN (".getEntity('product', 1).")";
|
||||
$sql.= " AND p.tobuy = 1";
|
||||
if ($socid) $sql.= " AND pfp.fk_soc = ".$socid;
|
||||
if (strval($filtertype) != '') $sql.=" AND p.fk_product_type=".$filtertype;
|
||||
if (! empty($filtre)) $sql.=" ".$filtre;
|
||||
// Add criteria on ref/label
|
||||
@@ -1404,7 +1415,7 @@ class Form
|
||||
$outval='';
|
||||
|
||||
$opt = '<option value="'.$objp->idprodfournprice.'"';
|
||||
if ($selected == $objp->idprodfournprice) $opt.= ' selected="selected"';
|
||||
if ($selected && $selected == $objp->idprodfournprice) $opt.= ' selected="selected"';
|
||||
if ($objp->fprice == '') $opt.=' disabled="disabled"';
|
||||
$opt.= '>';
|
||||
|
||||
@@ -2774,50 +2785,50 @@ class Form
|
||||
print $this->selectcurrency($selected,$htmlname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load into the cache all currencies
|
||||
*
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
function load_cache_currencies()
|
||||
{
|
||||
/**
|
||||
* Load into the cache all currencies
|
||||
*
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
function load_cache_currencies()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
if (count($this->cache_currencies)) return 0; // Cache deja charge
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
if (count($this->cache_currencies)) return 0; // Cache deja charge
|
||||
|
||||
$sql = "SELECT code_iso, label, unicode";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_currencies";
|
||||
$sql.= " WHERE active = 1";
|
||||
$sql.= " ORDER BY code_iso ASC";
|
||||
|
||||
dol_syslog(get_class($this).'::load_cache_currencies sql='.$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
$this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
|
||||
|
||||
dol_syslog(get_class($this).'::load_cache_currencies sql='.$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
|
||||
$this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $langs->trans("Currency".$obj->code_iso)!="Currency".$obj->code_iso?$langs->trans("Currency".$obj->code_iso):($obj->label!='-'?$obj->label:''));
|
||||
$this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode($obj->unicode, true);
|
||||
$label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label'];
|
||||
$i++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
array_multisort($label, SORT_ASC, $this->cache_currencies);
|
||||
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2882,32 +2893,32 @@ class Form
|
||||
print $this->load_tva($htmlname, $selectedrate, $societe_vendeuse, $societe_acheteuse, $idprod, $info_bits, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Load into the cache vat rates of a country
|
||||
*
|
||||
* @param string $country_code Country code
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
* @param string $country_code Country code
|
||||
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
|
||||
*/
|
||||
function load_cache_vatrates($country_code)
|
||||
function load_cache_vatrates($country_code)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
if (count($this->cache_vatrates)) return 0; // Cache deja charge
|
||||
|
||||
$sql = "SELECT DISTINCT t.taux, t.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql.= " WHERE t.fk_pays = p.rowid";
|
||||
$sql.= " AND t.active = 1";
|
||||
$sql.= " AND p.code IN (".$country_code.")";
|
||||
$sql.= " ORDER BY t.taux ASC, t.recuperableonly ASC";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
$sql = "SELECT DISTINCT t.taux, t.recuperableonly";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
|
||||
$sql.= " WHERE t.fk_pays = p.rowid";
|
||||
$sql.= " AND t.active = 1";
|
||||
$sql.= " AND p.code IN (".$country_code.")";
|
||||
$sql.= " ORDER BY t.taux ASC, t.recuperableonly ASC";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->cache_vatrates[$i]['txtva'] = $obj->taux;
|
||||
@@ -2927,7 +2938,7 @@ class Form
|
||||
{
|
||||
$this->error = '<font class="error">'.$this->db->error().'</font>';
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3023,32 +3034,32 @@ class Form
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
|
||||
{
|
||||
$defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
$defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
}
|
||||
|
||||
// Si taux par defaut n'a pu etre determine, on prend dernier de la liste.
|
||||
// Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
|
||||
{
|
||||
$defaulttx = $this->cache_vatrates[$num-1]['txtva'];
|
||||
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
|
||||
{
|
||||
$defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
$defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod);
|
||||
}
|
||||
|
||||
// Si taux par defaut n'a pu etre determine, on prend dernier de la liste.
|
||||
// Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant
|
||||
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
|
||||
{
|
||||
$defaulttx = $this->cache_vatrates[$num-1]['txtva'];
|
||||
}
|
||||
|
||||
if (! $options_only) $return.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
|
||||
foreach ($this->cache_vatrates as $rate)
|
||||
{
|
||||
$return.= '<option value="'.$rate['txtva'];
|
||||
$return.= $rate['nprtva'] ? '*': '';
|
||||
$return.= '<option value="'.$rate['txtva'];
|
||||
$return.= $rate['nprtva'] ? '*': '';
|
||||
$return.= '"';
|
||||
if ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr)
|
||||
{
|
||||
$return.= ' selected="selected"';
|
||||
}
|
||||
$return.= '>'.vatrate($rate['libtva']);
|
||||
}
|
||||
$return.= '>'.vatrate($rate['libtva']);
|
||||
$return.= $rate['nprtva'] ? ' *': '';
|
||||
$return.= '</option>';
|
||||
|
||||
@@ -3297,7 +3308,7 @@ class Form
|
||||
// Generate the date part, depending on the use or not of the javascript calendar
|
||||
if (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR == "eldy")
|
||||
{
|
||||
$base=DOL_URL_ROOT.'/core/lib/';
|
||||
$base=DOL_URL_ROOT.'/core/';
|
||||
$reset_scripts .= 'resetDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJava").'\',\''.$langs->defaultlang.'\');';
|
||||
}
|
||||
else
|
||||
@@ -3439,79 +3450,79 @@ class Form
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a multiselect form from an array.
|
||||
*
|
||||
/**
|
||||
* Show a multiselect form from an array.
|
||||
*
|
||||
* @param string $htmlname Name of select
|
||||
* @param array $array Array with key+value
|
||||
* @param array $array Array with key+value
|
||||
* @param array $selected Preselected keys
|
||||
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
|
||||
* @param int $value_as_key 1 to use value as key
|
||||
* @param string $option Valeur de l'option en fonction du type choisi
|
||||
* @param int $translate Translate and encode value
|
||||
* @return string HTML multiselect string
|
||||
*/
|
||||
function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $option='', $translate=0)
|
||||
{
|
||||
* @param int $translate Translate and encode value
|
||||
* @return string HTML multiselect string
|
||||
*/
|
||||
function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $option='', $translate=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$out = '<select id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.'>'."\n";
|
||||
if (is_array($array) && ! empty($array))
|
||||
|
||||
$out = '<select id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.'>'."\n";
|
||||
if (is_array($array) && ! empty($array))
|
||||
{
|
||||
if ($value_as_key) $array=array_combine($array, $array);
|
||||
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && is_array($selected) && ! empty($selected))
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && is_array($selected) && ! empty($selected))
|
||||
{
|
||||
foreach ($selected as $selected_value)
|
||||
{
|
||||
foreach($array as $key => $value)
|
||||
{
|
||||
if ($selected_value == $key)
|
||||
{
|
||||
$value=$array[$selected_value];
|
||||
$out.= '<option value="'.$key.'" selected="selected">';
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
unset($array[$key]);
|
||||
if ($selected_value == $key)
|
||||
{
|
||||
$value=$array[$selected_value];
|
||||
$out.= '<option value="'.$key.'" selected="selected">';
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($array))
|
||||
{
|
||||
foreach ($array as $key => $value)
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
$out.= '<option value="'.$key.'">';
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
$out.= '<option value="'.$key.'">';
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
$out.= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && ! empty($selected) && in_array($key, $selected))
|
||||
{
|
||||
$out.= ' selected="selected"';
|
||||
}
|
||||
$out.= '>';
|
||||
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
$out.= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && ! empty($selected) && in_array($key, $selected))
|
||||
{
|
||||
$out.= ' selected="selected"';
|
||||
}
|
||||
$out.= '>';
|
||||
|
||||
$newval = ($translate ? $langs->trans(ucfirst($value)) : $value);
|
||||
$newval = ($key_in_label ? $key.' - '.$newval : $newval);
|
||||
$out.= dol_htmlentitiesbr($newval);
|
||||
$out.= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$out.= '</select>'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
$out.= '</select>'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
@@ -3789,7 +3800,7 @@ class Form
|
||||
* @param int $force_entity Possibility to force entity
|
||||
* @return void
|
||||
*/
|
||||
function select_dolgroups($selected='',$htmlname='groupid',$show_empty=0,$exclude='',$disabled=0,$include='',$enableonly='',$force_entity='')
|
||||
function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='')
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -3802,14 +3813,14 @@ class Form
|
||||
|
||||
// On recherche les groupes
|
||||
$sql = "SELECT ug.rowid, ug.nom ";
|
||||
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$sql.= ", e.label";
|
||||
}
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."usergroup as ug ";
|
||||
if(! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
if (! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e on e.rowid=ug.entity";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e ON e.rowid=ug.entity";
|
||||
if ($force_entity) $sql.= " WHERE ug.entity IN (0,".$force_entity.")";
|
||||
else $sql.= " WHERE ug.entity IS NOT NULL";
|
||||
}
|
||||
@@ -3847,7 +3858,7 @@ class Form
|
||||
$out.= '>';
|
||||
|
||||
$out.= $obj->nom;
|
||||
if(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1)
|
||||
if (! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode) && $conf->entity == 1)
|
||||
{
|
||||
$out.= " (".$obj->label.")";
|
||||
}
|
||||
|
||||
@@ -1,185 +1,215 @@
|
||||
<?php
|
||||
/* Copyright (c) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/html.formactions.class.php
|
||||
* \ingroup core
|
||||
* \brief Fichier de la classe des fonctions predefinie de composants html actions
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage building of HTML components
|
||||
*/
|
||||
*/
|
||||
class FormActions
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function FormActions($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
function FormActions($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show list of action status
|
||||
*
|
||||
* @param string $formname Name of form where select in included
|
||||
* @param string $selected Preselected value
|
||||
* @param int $canedit 1=can edit, 0=read only
|
||||
* @param string $htmlname Name of html prefix for html fields (selectX and valX)
|
||||
* @return void
|
||||
*/
|
||||
function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete')
|
||||
{
|
||||
global $langs,$conf;
|
||||
/**
|
||||
* Show list of action status
|
||||
*
|
||||
* @param string $formname Name of form where select in included
|
||||
* @param string $selected Preselected value (-1..100)
|
||||
* @param int $canedit 1=can edit, 0=read only
|
||||
* @param string $htmlname Name of html prefix for html fields (selectX and valX)
|
||||
* @return void
|
||||
*/
|
||||
function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$listofstatus=array('-1'=>$langs->trans("ActionNotApplicable"),
|
||||
'0'=>$langs->trans("ActionRunningNotStarted"),
|
||||
'50'=>$langs->trans("ActionRunningShort"),
|
||||
'100'=>$langs->trans("ActionDoneShort"));
|
||||
$listofstatus = array(
|
||||
'-1' => $langs->trans("ActionNotApplicable"),
|
||||
'0' => $langs->trans("ActionRunningNotStarted"),
|
||||
'50' => $langs->trans("ActionRunningShort"),
|
||||
'100' => $langs->trans("ActionDoneShort")
|
||||
);
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n";
|
||||
print '<script type="text/javascript">'."\n";
|
||||
print 'jQuery(document).ready(function () {'."\n";
|
||||
print 'jQuery("#select'.$htmlname.'").change(function() { select_status(document.'.$formname.'.status.value); });'."\n";
|
||||
print 'jQuery("#val'.$htmlname.'").change(function() { select_status(document.'.$formname.'.status.value); });'."\n";
|
||||
print 'select_status(document.'.$formname.'.status.value);'."\n";
|
||||
print '});'."\n";
|
||||
print 'function select_status(mypercentage) {'."\n";
|
||||
print 'document.'.$formname.'.percentageshown.value=(mypercentage>=0?mypercentage:\'\');'."\n";
|
||||
print 'document.'.$formname.'.percentage.value=mypercentage;'."\n";
|
||||
print 'if (mypercentage == -1) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").hide(); }'."\n";
|
||||
print 'else if (mypercentage == 0) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").show();}'."\n";
|
||||
print 'else if (mypercentage == 100) { document.'.$formname.'.percentageshown.disabled=true; jQuery(".hideifna").show();}'."\n";
|
||||
print 'else { document.'.$formname.'.percentageshown.disabled=false; }'."\n";
|
||||
print '}'."\n";
|
||||
print '</script>'."\n";
|
||||
print '<select '.($canedit?'':'disabled="disabled" ').'name="status" id="select'.$htmlname.'" class="flat">';
|
||||
foreach($listofstatus as $key => $val)
|
||||
{
|
||||
print '<option value="'.$key.'"'.($selected == $key?' selected="selected"':'').'>'.$val.'</option>';
|
||||
}
|
||||
print '</select>';
|
||||
if ($selected == 0 || $selected == 100) $canedit=0;
|
||||
print ' <input type="text" id="val'.$htmlname.'" name="percentageshown" class="flat hideifna" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit&&($selected>=0)?'':' disabled="disabled"').'>';
|
||||
print '<span class="hideifna">%</span>';
|
||||
print ' <input type="hidden" name="percentage" value="'.$selected.'">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit?'':' disabled="disabled"').'>%';
|
||||
}
|
||||
}
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print "\n";
|
||||
print "<script type=\"text/javascript\">
|
||||
var htmlname = '".$htmlname."';
|
||||
|
||||
$(document).ready(function () {
|
||||
select_status();
|
||||
|
||||
$('#select' + htmlname).change(function() {
|
||||
select_status();
|
||||
});
|
||||
// FIXME use another method for update combobox
|
||||
//$('#val' + htmlname).change(function() {
|
||||
//select_status();
|
||||
//});
|
||||
});
|
||||
|
||||
function select_status() {
|
||||
var defaultvalue = $('#select' + htmlname).val();
|
||||
var percentage = $('input[name=percentage]');
|
||||
var selected = '".(isset($selected)?$selected:'')."';
|
||||
var value = (selected>0?selected:(defaultvalue>=0?defaultvalue:''));
|
||||
|
||||
percentage.val(value);
|
||||
|
||||
if (defaultvalue == -1) {
|
||||
percentage.attr('disabled', 'disabled');
|
||||
$('.hideifna').hide();
|
||||
}
|
||||
else if (defaultvalue == 0) {
|
||||
percentage.val(0);
|
||||
percentage.attr('disabled', 'disabled');
|
||||
$('.hideifna').show();
|
||||
}
|
||||
else if (defaultvalue == 100) {
|
||||
percentage.val(100);
|
||||
percentage.attr('disabled', 'disabled');
|
||||
$('.hideifna').show();
|
||||
}
|
||||
else {
|
||||
if (defaultvalue == 50 && (percentage.val() == 0 || percentage.val() == 100)) { percentage.val(50) };
|
||||
percentage.removeAttr('disabled');
|
||||
$('.hideifna').show();
|
||||
}
|
||||
}
|
||||
</script>\n";
|
||||
print '<select '.($canedit?'':'disabled="disabled" ').'name="status" id="select'.$htmlname.'" class="flat">';
|
||||
foreach($listofstatus as $key => $val)
|
||||
{
|
||||
print '<option value="'.$key.'"'.(($selected == $key) || (($selected > 0 && $selected < 100) && $key == '50') ? ' selected="selected"' : '').'>'.$val.'</option>';
|
||||
}
|
||||
print '</select>';
|
||||
if ($selected == 0 || $selected == 100) $canedit=0;
|
||||
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat hideifna" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit&&($selected>=0)?'':' disabled="disabled"').'>';
|
||||
print '<span class="hideifna">%</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat" value="'.($selected>=0?$selected:'').'" size="2"'.($canedit?'':' disabled="disabled"').'>%';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show list of actions for element
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter'
|
||||
* @param int $socid socid of user
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function showactions($object,$typeelement,$socid=0)
|
||||
{
|
||||
global $langs,$conf,$user;
|
||||
global $bc;
|
||||
/**
|
||||
* Show list of actions for element
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @param string $typeelement 'invoice','propal','order','invoice_supplier','order_supplier','fichinter'
|
||||
* @param int $socid socid of user
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function showactions($object,$typeelement,$socid=0)
|
||||
{
|
||||
global $langs,$conf,$user;
|
||||
global $bc;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/actioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/actioncomm.class.php");
|
||||
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
$actioncomm->getActions($socid, $object->id, $typeelement);
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
$actioncomm->getActions($socid, $object->id, $typeelement);
|
||||
|
||||
$num = count($actioncomm->actions);
|
||||
if ($num)
|
||||
{
|
||||
if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
|
||||
elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') $title=$langs->trans('ActionsOnBill');
|
||||
elseif ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal');
|
||||
elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
||||
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title=$langs->trans('ActionsOnOrder');
|
||||
elseif ($typeelement == 'project') $title=$langs->trans('ActionsOnProject');
|
||||
elseif ($typeelement == 'shipping') $title=$langs->trans('ActionsOnShipping');
|
||||
elseif ($typeelement == 'fichinter') $title=$langs->trans('ActionsOnFicheInter');
|
||||
else $title=$langs->trans("Actions");
|
||||
$num = count($actioncomm->actions);
|
||||
if ($num)
|
||||
{
|
||||
if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
|
||||
elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') $title=$langs->trans('ActionsOnBill');
|
||||
elseif ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal');
|
||||
elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
||||
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title=$langs->trans('ActionsOnOrder');
|
||||
elseif ($typeelement == 'project') $title=$langs->trans('ActionsOnProject');
|
||||
elseif ($typeelement == 'shipping') $title=$langs->trans('ActionsOnShipping');
|
||||
elseif ($typeelement == 'fichinter') $title=$langs->trans('ActionsOnFicheInter');
|
||||
else $title=$langs->trans("Actions");
|
||||
|
||||
print_titre($title);
|
||||
print_titre($title);
|
||||
|
||||
$total = 0; $var=true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans('Ref').'</th><th class="liste_titre">'.$langs->trans('Date').'</th><th class="liste_titre">'.$langs->trans('Action').'</th><th class="liste_titre">'.$langs->trans('By').'</th></tr>';
|
||||
print "\n";
|
||||
$total = 0; $var=true;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans('Ref').'</th><th class="liste_titre">'.$langs->trans('Date').'</th><th class="liste_titre">'.$langs->trans('Action').'</th><th class="liste_titre">'.$langs->trans('By').'</th></tr>';
|
||||
print "\n";
|
||||
|
||||
foreach($actioncomm->actions as $action)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$action->getNomUrl(1).'</td>';
|
||||
print '<td>'.dol_print_date($action->datep,'day').'</td>';
|
||||
print '<td title="'.dol_escape_htmltag($action->label).'">'.dol_trunc($action->label,32).'</td>';
|
||||
$userstatic = new User($this->db);
|
||||
$userstatic->id = $action->author->id;
|
||||
$userstatic->firstname = $action->author->firstname;
|
||||
$userstatic->lastname = $action->author->lastname;
|
||||
print '<td>'.$userstatic->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
foreach($actioncomm->actions as $action)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$action->getNomUrl(1).'</td>';
|
||||
print '<td>'.dol_print_date($action->datep,'day').'</td>';
|
||||
print '<td title="'.dol_escape_htmltag($action->label).'">'.dol_trunc($action->label,32).'</td>';
|
||||
$userstatic = new User($this->db);
|
||||
$userstatic->id = $action->author->id;
|
||||
$userstatic->firstname = $action->author->firstname;
|
||||
$userstatic->lastname = $action->author->lastname;
|
||||
print '<td>'.$userstatic->getNomUrl(1).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
return $num;
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Output list of type of event
|
||||
*
|
||||
* @param string $selected Type pre-selectionne
|
||||
* @param string $htmlname Nom champ formulaire
|
||||
* @return void
|
||||
*/
|
||||
function select_type_actions($selected='',$htmlname='actioncode')
|
||||
{
|
||||
global $langs,$user;
|
||||
/**
|
||||
* Output list of type of event
|
||||
*
|
||||
* @param string $selected Type pre-selectionne
|
||||
* @param string $htmlname Nom champ formulaire
|
||||
* @return void
|
||||
*/
|
||||
function select_type_actions($selected='',$htmlname='actioncode')
|
||||
{
|
||||
global $langs,$user;
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/cactioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.form.class.php");
|
||||
$caction=new CActionComm($this->db);
|
||||
$form=new Form($this->db);
|
||||
require_once(DOL_DOCUMENT_ROOT."/comm/action/class/cactioncomm.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/html.form.class.php");
|
||||
$caction=new CActionComm($this->db);
|
||||
$form=new Form($this->db);
|
||||
|
||||
$arraylist=$caction->liste_array(1,'code');
|
||||
array_unshift($arraylist,' '); // Add empty line at start
|
||||
//asort($arraylist);
|
||||
$arraylist=$caction->liste_array(1,'code');
|
||||
array_unshift($arraylist,' '); // Add empty line at start
|
||||
//asort($arraylist);
|
||||
|
||||
print $form->selectarray($htmlname, $arraylist, $selected);
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
}
|
||||
print $form->selectarray($htmlname, $arraylist, $selected);
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ class FormBarCode
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setbarcodetype">';
|
||||
print '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
$this->select_barcode_type($selected, $htmlname, 1);
|
||||
|
||||
@@ -59,13 +59,14 @@ class FormFile
|
||||
* @param int $size Length of input file area
|
||||
* @param Object $object Object to use (when attachment is done on an element)
|
||||
* @param string $options Options
|
||||
* @param boolean $useajax Use ajax if enabled
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='')
|
||||
function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=true)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
if ($conf->global->MAIN_USE_JQUERY_FILEUPLOAD)
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax)
|
||||
{
|
||||
return $this->_formAjaxFileUpload($object);
|
||||
}
|
||||
@@ -596,7 +597,7 @@ class FormFile
|
||||
print '</a>';
|
||||
print "</td>\n";
|
||||
print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';
|
||||
print '<td align="center">'.dol_print_date($file['date'],"dayhour").'</td>';
|
||||
print '<td align="center">'.dol_print_date($file['date'],"dayhour","tzuser").'</td>';
|
||||
// Preview
|
||||
if (empty($useinecm))
|
||||
{
|
||||
@@ -805,102 +806,11 @@ class FormFile
|
||||
// Max file size
|
||||
$max_file_size = (($post_max_size < $upload_max_filesize) ? $post_max_size : $upload_max_filesize);
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
\'use strict\';
|
||||
|
||||
var max_file_size = \''.$max_file_size.'\';
|
||||
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$("#fileupload").fileupload({
|
||||
maxFileSize: max_file_size,
|
||||
done: function (e, data) {
|
||||
$.ajax(data).success(function () {
|
||||
location.href=\''.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].'\';
|
||||
});
|
||||
},
|
||||
destroy: function (e, data) {
|
||||
var that = $(this).data("fileupload");
|
||||
if ( confirm("Delete this file ?") == true ) {
|
||||
if (data.url) {
|
||||
$.ajax(data).success(function () {
|
||||
that._adjustMaxNumberOfFiles(1);
|
||||
$(this).fadeOut(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
data.context.fadeOut(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Load existing files:
|
||||
// TODO do not delete
|
||||
if (1 == 2) {
|
||||
$.getJSON($("#fileupload form").prop("action"), { fk_element: "'.$object->id.'", element: "'.$object->element.'"}, function (files) {
|
||||
var fu = $("#fileupload").data("fileupload");
|
||||
fu._adjustMaxNumberOfFiles(-files.length);
|
||||
fu._renderDownload(files)
|
||||
.appendTo($("#fileupload .files"))
|
||||
.fadeIn(function () {
|
||||
// Fix for IE7 and lower:
|
||||
$(this).show();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Open download dialogs via iframes,
|
||||
// to prevent aborting current uploads:
|
||||
$("#fileupload .files a:not([target^=_blank])").live("click", function (e) {
|
||||
e.preventDefault();
|
||||
$(\'<iframe style="display:none;"></iframe>\')
|
||||
.prop("src", this.href)
|
||||
.appendTo("body");
|
||||
});
|
||||
|
||||
});
|
||||
</script>';
|
||||
|
||||
print '<div id="fileupload">';
|
||||
print '<form action="'.DOL_URL_ROOT.'/core/ajax/fileupload.php" method="POST" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="fk_element" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="element" value="'.$object->element.'">';
|
||||
print '<div class="fileupload-buttonbar">';
|
||||
print '<input type="hidden" name="protocol" value="http">';
|
||||
print '<label class="fileinput-button">';
|
||||
print '<span>'.$langs->trans('AddFiles').'</span>';
|
||||
print '<input type="file" name="files[]" multiple>';
|
||||
print '</label>';
|
||||
print '<button type="submit" class="start">'.$langs->trans('StartUpload').'</button>';
|
||||
print '<button type="reset" class="cancel">'.$langs->trans('CancelUpload').'</button>';
|
||||
print '</div></form>';
|
||||
|
||||
print '</div><!-- end div fileupload -->';
|
||||
|
||||
print '<div id="fileupload-view">';
|
||||
print '<div class="fileupload-content">';
|
||||
|
||||
print '<table width="100%" class="files">';
|
||||
/*print '<tr>';
|
||||
print '<td>'.$langs->trans("Documents2").'</td>';
|
||||
print '<td>'.$langs->trans("Preview").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Size").'</td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '</tr>';*/
|
||||
print '</table>';
|
||||
|
||||
// We remove this because there is already individual bars.
|
||||
//print '<div class="fileupload-progressbar"></div>';
|
||||
|
||||
print '</div><!-- end div fileupload-content -->';
|
||||
print '</div><!-- end div fileupload-view -->';
|
||||
// Include main
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajax/fileupload_main.tpl.php');
|
||||
|
||||
// Include template
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajaxfileupload.tpl.php');
|
||||
include(DOL_DOCUMENT_ROOT.'/core/tpl/ajax/fileupload_view.tpl.php');
|
||||
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user