forked from Wavyzz/dolibarr
Compare commits
245 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7856b7f613 | ||
|
|
469ae91e70 | ||
|
|
d5d4bc33ba | ||
|
|
1109527528 | ||
|
|
992600664e | ||
|
|
b36a16ed43 | ||
|
|
f08ce6d96a | ||
|
|
416cdd2f9c | ||
|
|
f8ca842685 | ||
|
|
fea0e6de54 | ||
|
|
347fc6d714 | ||
|
|
e2f2ad30ae | ||
|
|
2879a09a03 | ||
|
|
7efe39495a | ||
|
|
e3615d43bd | ||
|
|
047aa8ea29 | ||
|
|
5fe70e0bee | ||
|
|
8a90598b23 | ||
|
|
e4dda125d8 | ||
|
|
526a80dd20 | ||
|
|
cb3b0996ce | ||
|
|
9992fc803d | ||
|
|
9427e32e2e | ||
|
|
661071286e | ||
|
|
3aa049b661 | ||
|
|
934657cc2f | ||
|
|
0bb9ee158a | ||
|
|
8bd7c6a763 | ||
|
|
bdb81803bd | ||
|
|
95e4474906 | ||
|
|
1c9caeb0d3 | ||
|
|
c8ef07a889 | ||
|
|
723bd6f750 | ||
|
|
a35a44b23e | ||
|
|
7428c11489 | ||
|
|
c65620ab62 | ||
|
|
f8f4fd3a6f | ||
|
|
4687350337 | ||
|
|
3a531f048a | ||
|
|
36479db0fd | ||
|
|
7e47b37ade | ||
|
|
97478ccbf2 | ||
|
|
95f63a8171 | ||
|
|
a9e63610ae | ||
|
|
f3480bf502 | ||
|
|
7f27801c3c | ||
|
|
8d844a1094 | ||
|
|
7d71be2227 | ||
|
|
c84427bd22 | ||
|
|
3933fb318c | ||
|
|
e9f02ebacf | ||
|
|
440912a4d3 | ||
|
|
ac6e56f058 | ||
|
|
f8b133dad4 | ||
|
|
59f218ab42 | ||
|
|
114ace6499 | ||
|
|
74abde0233 | ||
|
|
4a9ed428f0 | ||
|
|
947bda1af8 | ||
|
|
4274a1aa21 | ||
|
|
fd85755461 | ||
|
|
00adb1b9ab | ||
|
|
63c474e2cc | ||
|
|
c4a064d104 | ||
|
|
1d52d50ac1 | ||
|
|
0661f9f1f8 | ||
|
|
647956576d | ||
|
|
89eec9bfbd | ||
|
|
54fc731df7 | ||
|
|
de1f53db45 | ||
|
|
f8e0f40ffa | ||
|
|
ab668f0f07 | ||
|
|
0672d10a3f | ||
|
|
bd2b363e40 | ||
|
|
8e7b72d09e | ||
|
|
7a115a9216 | ||
|
|
ecaea4c575 | ||
|
|
1065645fb6 | ||
|
|
24309a7f17 | ||
|
|
3203283fe9 | ||
|
|
b1cf0b9a76 | ||
|
|
44a1120c06 | ||
|
|
652e0c1b5f | ||
|
|
c0a3271d76 | ||
|
|
c969d17e48 | ||
|
|
36e6269b24 | ||
|
|
b67faf1eb1 | ||
|
|
4ff5922a55 | ||
|
|
9e1487fc61 | ||
|
|
016b4a2baa | ||
|
|
ed5a00a79d | ||
|
|
d162a61d41 | ||
|
|
2f72bbca5a | ||
|
|
733ff62ec8 | ||
|
|
bc7015a431 | ||
|
|
521929b740 | ||
|
|
4badcf5a75 | ||
|
|
cd7f94d515 | ||
|
|
b2129a519d | ||
|
|
436b6259c0 | ||
|
|
026195689b | ||
|
|
08808c58cd | ||
|
|
fb1c306b31 | ||
|
|
57637d3a07 | ||
|
|
23a7aae084 | ||
|
|
52a1e81147 | ||
|
|
ba0e9c0c19 | ||
|
|
365a5e18e8 | ||
|
|
57ab4fb798 | ||
|
|
624a039eaf | ||
|
|
8f502b8cfc | ||
|
|
dbc2eddcba | ||
|
|
3f1f065d4e | ||
|
|
ff3b2933a8 | ||
|
|
c8b2ce3d8e | ||
|
|
83e873dd24 | ||
|
|
f8ddd69ccb | ||
|
|
7217d91f13 | ||
|
|
ccf809b14a | ||
|
|
5ccb4108d4 | ||
|
|
7883e4f0eb | ||
|
|
63a5aee80e | ||
|
|
88fe3e86f2 | ||
|
|
b9dab6d059 | ||
|
|
6adaf2fa8f | ||
|
|
6b8c4fc3f2 | ||
|
|
4202c8fc91 | ||
|
|
880659af3a | ||
|
|
fa69f693db | ||
|
|
6a9ebcac7b | ||
|
|
95ca8db9eb | ||
|
|
d90a0acbec | ||
|
|
40a9ab9772 | ||
|
|
458b1cdf60 | ||
|
|
de2a5a8872 | ||
|
|
8030b39536 | ||
|
|
becd40a825 | ||
|
|
a3c5bef381 | ||
|
|
50ec96d368 | ||
|
|
17d5ab9774 | ||
|
|
df0b0ebf51 | ||
|
|
3e9a8677c6 | ||
|
|
52a0df3424 | ||
|
|
21a1441a80 | ||
|
|
5c50b1db57 | ||
|
|
03e57c229a | ||
|
|
e7cec6d410 | ||
|
|
e2156b5df7 | ||
|
|
3a474a22ca | ||
|
|
a5deb8e9d7 | ||
|
|
90a2a86dbb | ||
|
|
1602fcf7bc | ||
|
|
7d6c89169c | ||
|
|
7177e59ea4 | ||
|
|
21056d2b78 | ||
|
|
76132206bf | ||
|
|
67b803243f | ||
|
|
6d896a8558 | ||
|
|
deaa63960e | ||
|
|
e27e5e9c44 | ||
|
|
e934614fce | ||
|
|
cb8cbecbde | ||
|
|
0e34df43b1 | ||
|
|
b6ce386513 | ||
|
|
90b9e7c136 | ||
|
|
6b031616fa | ||
|
|
6ebeb53a2c | ||
|
|
486425d258 | ||
|
|
7e48e341ad | ||
|
|
8d4da9df1e | ||
|
|
7c4b901b0a | ||
|
|
418921f360 | ||
|
|
a6ed2551fb | ||
|
|
580881c205 | ||
|
|
85866ff9a6 | ||
|
|
404ad18425 | ||
|
|
b3a035951f | ||
|
|
3ed4d7bfbf | ||
|
|
d6b42ac879 | ||
|
|
1409b2b81a | ||
|
|
ac0cd975cd | ||
|
|
b6f765ef3c | ||
|
|
9596134e47 | ||
|
|
85e09a953f | ||
|
|
4910871180 | ||
|
|
9ec74194a0 | ||
|
|
662d9cfa6e | ||
|
|
76c180aaaf | ||
|
|
d570aa02d4 | ||
|
|
3bcd506e73 | ||
|
|
43d4bb6155 | ||
|
|
72f0ca194c | ||
|
|
c4d0c4c3e5 | ||
|
|
5d94b0c576 | ||
|
|
19e902ef8f | ||
|
|
b80d4874e3 | ||
|
|
057365b69e | ||
|
|
eb78de1981 | ||
|
|
38e30836a5 | ||
|
|
8118332dfb | ||
|
|
f17ba4814e | ||
|
|
98aaec18a7 | ||
|
|
f3bbfe375c | ||
|
|
4ce7a70411 | ||
|
|
19c8336e6e | ||
|
|
303cf3bc41 | ||
|
|
6013916d45 | ||
|
|
b678183ff2 | ||
|
|
29124649bd | ||
|
|
8f67606685 | ||
|
|
35279f6520 | ||
|
|
515c5e58ca | ||
|
|
64a9689473 | ||
|
|
4ceeea4a1c | ||
|
|
56f48245f1 | ||
|
|
6252857440 | ||
|
|
c10f2dd327 | ||
|
|
bbb0854517 | ||
|
|
5736cf0144 | ||
|
|
09d1e56ca5 | ||
|
|
81b34f9918 | ||
|
|
ef5c03fc99 | ||
|
|
992ec308d2 | ||
|
|
61b28274f7 | ||
|
|
5af232d936 | ||
|
|
be01297403 | ||
|
|
9572eebae0 | ||
|
|
e0baa0fe46 | ||
|
|
1e3b26a104 | ||
|
|
888da9f3e9 | ||
|
|
3c3c0b456e | ||
|
|
e0bf4faa4c | ||
|
|
0108ee2bd8 | ||
|
|
c36f52c47a | ||
|
|
a701cbd77c | ||
|
|
4fe94b800b | ||
|
|
dff74667c2 | ||
|
|
33a82c396e | ||
|
|
7f4fd06f19 | ||
|
|
c7666cbc3d | ||
|
|
f4996b4054 | ||
|
|
e2f28b6c51 | ||
|
|
8a6adb8a49 | ||
|
|
f8291a9efe | ||
|
|
e59084cafc |
31
ChangeLog
31
ChangeLog
@@ -4,6 +4,36 @@ English Dolibarr ChangeLog
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.3.2 compared to 3.3.1 *****
|
||||
|
||||
- Fix: Dutch (nl_NL) translation
|
||||
- Generalize fix: file with a specific mask not found, again
|
||||
- Fix: translations and BILL_SUPPLIER_BUILDDOC trigger
|
||||
- Fix: Can't reset payment due date
|
||||
- Fix: Orderstoinvoice didn't act as expected when no order was checked
|
||||
- Fix: Bad link to all proposals into Third party card if customer is prospect
|
||||
- Fix: Some bugs on withdrawal rejects
|
||||
- Fix: [ bug #774 ] Bug on creating event with box "all day" crossed
|
||||
- Fix: [ bug #787 ] Invoice supplier box incorrect tooltip when delay on payment
|
||||
- Fix: [ bug #789 ] VAT not being calculated in POS
|
||||
- Fix: [ bug #790 ] Spanish localtax RE not being correctly calculated
|
||||
- Fix: [ bug #794 ] Lost filter on zipcode in prospect list
|
||||
- Fix: [ bug #806 ] Margins module with orders2invoice does not respect cost price
|
||||
- Fix: [ bug #810 ] Cannot update ODT template path
|
||||
- Fix: [ bug #816 ] Sales journal does not reflect localtaxes
|
||||
- Fix: [ bug #817 ] Purchases journal does not reflect localtaxes
|
||||
- Fix: [ bug #824 ] MAIN_DB_PREFIX not use into dictionnary
|
||||
- Fix: [ bug #828 ] Error when code_region is not a number in llx_c_regions (with postgres)
|
||||
- Fix: [ bug #855 ] Holiday approval email in French
|
||||
- Fix: [ bug #856 ] (Holidays module) Mail error if destination user doesn't have an email
|
||||
- Fix: [ bug #857 ] Invoice created from shipment does not have the order discount
|
||||
- Fix: [ bug #861 ] Impossible to create a new event in agenda
|
||||
- Fix: [ bug #827 ] AJAX search does not respect multiprice level
|
||||
- Fix: [ bug #865 ] Dolibarr navigation array in project/task do not work
|
||||
- Fix: [ bug #866 ] Standing order from an invoice suggests invoice total amount instead of remaining to pay
|
||||
- Fix: [ bug #788 ] Date of linked interventions are not shown
|
||||
- Fix: external users should not see costprice and margin infos
|
||||
|
||||
***** ChangeLog for 3.3.1 compared to 3.3 *****
|
||||
|
||||
- Fix: [ bug #733 ] Mass emailing tools do not support <style HTML tag
|
||||
@@ -11,6 +41,7 @@ English Dolibarr ChangeLog
|
||||
- Fix: [ bug #736 ] Missing column in llx_c_chargesociales
|
||||
- Fix: Localtax2 for Spain must be based into buyer
|
||||
- Fix: [ bug #762 ] Bad profit calculation in Reporting
|
||||
- Fix: bug dictionnary with wrong prefix table
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ with format .DEB (for Debian, Ubuntu, ...).
|
||||
|
||||
# This is standard command to work on Debian packaging:
|
||||
#
|
||||
# gpg --gen-key Generate a GPG key
|
||||
# gpg --gen-key Generate a GPG key (-> pubring.gpg + secring.gpg)
|
||||
#
|
||||
# debconf-updatepo To run into po dir to regenate templates.pot
|
||||
# podebconf-report-po --from email@email.com To send email to ask translations
|
||||
@@ -43,10 +43,11 @@ To submit a package to Debian:
|
||||
See page http://www.debian.org/devel/wnpp/#l1 for example of ITP requests contents.
|
||||
|
||||
- Wait until you received bug number.
|
||||
For first ITP submission of Dolibarr, bug id was 634783.
|
||||
For first ITP submission of Dolibarr, bug id was 634783.
|
||||
|
||||
- Check bug is into database by searching with id on http://www.debian.org/Bugs/
|
||||
|
||||
- Check bug is into database by searching with id on
|
||||
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634783
|
||||
|
||||
- Add a line for upstream into file changelog with bug number
|
||||
|
||||
- Call for a mentor on ML debian-mentors to upload packages
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
dolibarr (3.3.1+nmu1) unstable; urgency=low
|
||||
dolibarr (3.3.2+nmu1) unstable; urgency=low
|
||||
|
||||
* Non-maintainer upload.
|
||||
* New upstream release.
|
||||
closes: bug#634783
|
||||
|
||||
-- Dolibarr team <contact@dolibarr.org> Sat, 2 Mar 2013 12:00:00 +0100
|
||||
-- Dolibarr team <contact@dolibarr.org> Mon, 22 Apr 2013 12:00:00 +0100
|
||||
|
||||
# For a changelog file dedicated to end users, see /usr/share/doc/dolibarr/ChangeLog.gz
|
||||
@@ -14,8 +14,8 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 1.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-08-01 18:17+0200\n"
|
||||
"Report-Msgid-Bugs-To: dolibarr@packages.debian.org\n"
|
||||
"POT-Creation-Date: 2013-04-23 12:16+0200\n"
|
||||
"PO-Revision-Date: 2011-07-29 22:45+0100\n"
|
||||
"Last-Translator: Laurent Destailleur <eldy@users.sourceforge.net>\n"
|
||||
"Language-Team: Laurent Destailleur <eldy@users.sourceforge.net>\n"
|
||||
@@ -27,13 +27,13 @@ msgstr ""
|
||||
|
||||
#. Type: multiselect
|
||||
#. Description
|
||||
#: ../templates:1001
|
||||
#: ../dolibarr.templates:1001
|
||||
msgid "Web server to reconfigure automatically:"
|
||||
msgstr "Seveur web à reconfigurer automatiquement:"
|
||||
|
||||
#. Type: multiselect
|
||||
#. Description
|
||||
#: ../templates:1001
|
||||
#: ../dolibarr.templates:1001
|
||||
msgid ""
|
||||
"Please choose the web server that should be automatically configured to run "
|
||||
"dolibarr."
|
||||
@@ -44,14 +44,14 @@ msgstr ""
|
||||
#
|
||||
#. Type: boolean
|
||||
#. Description
|
||||
#: ../templates:2001
|
||||
#: ../dolibarr.templates:2001
|
||||
msgid "Delete database and uploaded files ?"
|
||||
msgstr "Effacer la base de donnée et les fichiers uploadés ?"
|
||||
|
||||
#
|
||||
#. Type: boolean
|
||||
#. Description
|
||||
#: ../templates:2001
|
||||
#: ../dolibarr.templates:2001
|
||||
msgid ""
|
||||
"Answer if you want to removed the Dolibarr MySQL database and all other "
|
||||
"datas (datas related to this question are the Dolibarr DBMS account, all "
|
||||
|
||||
15
build/debian/po/templates.pot
Executable file → Normal file
15
build/debian/po/templates.pot
Executable file → Normal file
@@ -3,11 +3,12 @@
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-08-01 18:17+0200\n"
|
||||
"Project-Id-Version: dolibarr\n"
|
||||
"Report-Msgid-Bugs-To: dolibarr@packages.debian.org\n"
|
||||
"POT-Creation-Date: 2013-04-23 12:16+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -18,13 +19,13 @@ msgstr ""
|
||||
|
||||
#. Type: multiselect
|
||||
#. Description
|
||||
#: ../templates:1001
|
||||
#: ../dolibarr.templates:1001
|
||||
msgid "Web server to reconfigure automatically:"
|
||||
msgstr ""
|
||||
|
||||
#. Type: multiselect
|
||||
#. Description
|
||||
#: ../templates:1001
|
||||
#: ../dolibarr.templates:1001
|
||||
msgid ""
|
||||
"Please choose the web server that should be automatically configured to run "
|
||||
"dolibarr."
|
||||
@@ -32,13 +33,13 @@ msgstr ""
|
||||
|
||||
#. Type: boolean
|
||||
#. Description
|
||||
#: ../templates:2001
|
||||
#: ../dolibarr.templates:2001
|
||||
msgid "Delete database and uploaded files ?"
|
||||
msgstr ""
|
||||
|
||||
#. Type: boolean
|
||||
#. Description
|
||||
#: ../templates:2001
|
||||
#: ../dolibarr.templates:2001
|
||||
msgid ""
|
||||
"Answer if you want to removed the Dolibarr MySQL database and all other "
|
||||
"datas (datas related to this question are the Dolibarr DBMS account, all "
|
||||
|
||||
@@ -112,6 +112,9 @@ clean:
|
||||
rm -fr htdocs/includes/tcpdf/fonts/freefont-20100919
|
||||
rm -fr htdocs/includes/tcpdf/fonts/utils
|
||||
|
||||
# clean from files to avoid warning of missing dependencies
|
||||
rm -fr htdocs/includes/jquery/plugins/jqueryFileTree/connectors/jqueryFileTree.py
|
||||
|
||||
# Licence files are included into copyright file.
|
||||
rm -fr htdocs/includes/phpexcel/license.txt
|
||||
rm -f htdocs/includes/tcpdf/LICENSE.TXT
|
||||
|
||||
@@ -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.3.0
|
||||
PROJECT_NUMBER = 3.3.2
|
||||
|
||||
# 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.3.1
|
||||
AppVerName=DoliWamp-3.3.2
|
||||
; 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.3.1
|
||||
OutputBaseFilename=DoliWamp-3.3.2
|
||||
; 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\ldestailleur\git\dolibarr_old
|
||||
@@ -33,7 +33,7 @@ AppPublisherURL=http://www.nltechno.com
|
||||
AppSupportURL=http://www.dolibarr.org
|
||||
AppUpdatesURL=http://www.dolibarr.org
|
||||
AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares.
|
||||
AppCopyright=Copyright (C) 2008-2012 Laurent Destailleur, NLTechno
|
||||
AppCopyright=Copyright (C) 2008-2013 Laurent Destailleur, NLTechno
|
||||
DefaultDirName=c:\dolibarr
|
||||
DefaultGroupName=Dolibarr
|
||||
;LicenseFile=COPYING
|
||||
|
||||
@@ -28,6 +28,8 @@ a package onto LaunchPad
|
||||
- Edit file ~/.bashrc to add
|
||||
DEBFULLNAME="<Your name>"
|
||||
DEBEMAIL="<Your email address>"
|
||||
- Create a Bazaar directory
|
||||
mkdir bzr
|
||||
|
||||
If you want to build/test package locally:
|
||||
- Create a file ~/.pbuilderrc with content
|
||||
@@ -36,24 +38,43 @@ If you want to build/test package locally:
|
||||
sudo pbuilder create [--distribution sid|squeeze]
|
||||
|
||||
|
||||
# Push/declare sources to Launchpad
|
||||
# Push/declare Dolibarr sources to Launchpad
|
||||
#----------------------------------
|
||||
|
||||
- Create a Bazaar directory
|
||||
mkdir bzr
|
||||
- Create a series
|
||||
Call it 'dev' or 'stable'
|
||||
For stable: Add file with *: http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_3.2.*.tar.gz
|
||||
For dev: Configure Series branch - Link to series
|
||||
- From Launchpad project (https://launchpad.net/dolibarr), register a series:
|
||||
Call it 'trunk' or 'beta' or 'stable'
|
||||
Use branch (dev):
|
||||
~eldy/dolibarr/develop
|
||||
~eldy/dolibarr/beta
|
||||
~eldy/dolibarr/stable
|
||||
or
|
||||
Use URL pattern (beta or stable):
|
||||
http://www.dolibarr.org/files/lastbuild/package_debian-ubuntu/dolibarr_x.z.*.tar.gz
|
||||
http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_x.y.*.tar.gz
|
||||
|
||||
- For Dev, you can also add link serie to GIT HEAD.
|
||||
- For beta and stable, you can init from command line
|
||||
cd bzr/dolibarr-[beta|stable]
|
||||
bzr init
|
||||
bzr add
|
||||
bzr commit -m "Init"
|
||||
bzr push lp:~yourlogin/dolibarr/stable
|
||||
bzr push lp:~yourlogin/dolibarr/[beta|stable]
|
||||
|
||||
# Init repository of sources into launchpad (when repository for sources does not exist)
|
||||
- List of series are visible here: https://launchpad.net/dolibarr/+series
|
||||
|
||||
# To update Dolibarr into launchpad (when repository for sources already exists)
|
||||
#----------------------------------
|
||||
cd bzr
|
||||
bzr branch lp:~yourlogin/dolibarr/[dev|beta|stable]
|
||||
cd dolibarr-[dev|beta|stable]
|
||||
bzr status
|
||||
-- Update files here --
|
||||
bzr commit -m "Description of change"
|
||||
bzr push
|
||||
|
||||
- Create debian directory and upload it onto bzr branch ~yourlogin/+junk/debian-[dev|stable]
|
||||
|
||||
# Init debian dir repository into launchpad (when repository for sources does not exist)
|
||||
#----------------------------------
|
||||
- Create debian directory and upload it onto bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
cd bzr
|
||||
mkdir debian
|
||||
cd debian
|
||||
@@ -61,24 +82,29 @@ If you want to build/test package locally:
|
||||
bzr init
|
||||
bzr add
|
||||
bzr commit -m "Init control files"
|
||||
bzr push lp:~yourlogin/+junk/debian-[dev|stable] (put here any branch name)
|
||||
or download it from launchpad bazaar:
|
||||
bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable] (put here any branch name)
|
||||
- or download it from launchpad bazaar:
|
||||
cd bzr
|
||||
bzr branch lp:~yourlogin/+junk/debian-[dev|stable]
|
||||
- To update this debian directory, edit files into the bzr dir and run
|
||||
bzr status
|
||||
bzr commit -m "Description of change"
|
||||
bzr push lp:~yourlogin/+junk/debian-[dev|stable]
|
||||
bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
|
||||
# Get repository of sources from launchpad (when repository for sources already exists)
|
||||
# Get debian dir repository from launchpad (when repository for sources already exists)
|
||||
#----------------------------------
|
||||
cd bzr
|
||||
bzr branch lp:~yourlogin/+junk/debian-[dev|stable]
|
||||
bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
|
||||
# To update debian dir into launchpad (when repository for sources already exists)
|
||||
#----------------------------------
|
||||
cd bzr
|
||||
bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
cd debian-[dev|beta|stable]
|
||||
bzr status
|
||||
-- Update files here --
|
||||
bzr commit -m "Description of change"
|
||||
bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
|
||||
|
||||
# Define a recipe into launchpad (a rule to build packages into a PPA)
|
||||
#----------------------------------
|
||||
|
||||
- Create a file dolibarr.recipe with content
|
||||
cd bzr
|
||||
vi dolibarr.recipe
|
||||
@@ -101,11 +127,11 @@ If you want to build/test package locally:
|
||||
# To get/download package from PPA:
|
||||
#----------------------------------
|
||||
|
||||
Add signing key of the Launchpad repository:
|
||||
- Add signing key of the Launchpad repository:
|
||||
> gpg --keyserver keyserver.ubuntu.com --recv-key A38BF8FD
|
||||
> sudo apt-key add ~/.gnupg/pubring.gpg
|
||||
|
||||
Add Dolibarr Launchpad repository to your system setup by adding the two lines to /etc/apt/sources.list
|
||||
- Add Dolibarr Launchpad repository to your system setup by adding the two lines to /etc/apt/sources.list
|
||||
For the development snapshot version:
|
||||
deb http://ppa.launchpad.net/yourlogin/dolibarr-dev/ubuntu precise main
|
||||
deb-src http://ppa.launchpad.net/yourlogin/dolibarr-dev/ubuntu precise main
|
||||
@@ -113,12 +139,10 @@ For the stable version:
|
||||
deb http://ppa.launchpad.net/yourlogin/dolibarr-stable/ubuntu precise main
|
||||
deb-src http://ppa.launchpad.net/yourlogin/dolibarr-stable/ubuntu precise main
|
||||
|
||||
Update your package cache:
|
||||
- Update your package cache:
|
||||
> apt-get update
|
||||
|
||||
Install Dolibarr:
|
||||
- Install Dolibarr:
|
||||
> apt-get install dolibarr
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use Cwd;
|
||||
$PROJECT="dolibarr";
|
||||
$MAJOR="3";
|
||||
$MINOR="3";
|
||||
$BUILD="1"; # Mettre x pour release, x-dev pour dev, x-beta pour beta, x-rc pour release candidate
|
||||
$BUILD="2"; # 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
|
||||
@@ -656,6 +656,8 @@ if ($nboftargetok) {
|
||||
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/skeletons/skeleton_webservice_server.php`;
|
||||
$cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.php' -type f -exec chmod 755 {} \\; ";
|
||||
$ret=`$cmd`;
|
||||
$cmd="find $BUILDROOT/$PROJECT.tmp/scripts -name '*.sh' -type f -exec chmod 755 {} \\; ";
|
||||
$ret=`$cmd`;
|
||||
|
||||
|
||||
print "Rename directory $BUILDROOT/$PROJECT.tmp into $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
|
||||
|
||||
@@ -32,7 +32,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 in htdocs/filefunc.inc.php
|
||||
- Update version number with x.x.x in build/makepack-dolibarr.pl
|
||||
- Update version number with x.x.x in build/debian/changelog
|
||||
|
||||
@@ -23,10 +23,13 @@ To submit a snapshot for building, we should have a service file with content
|
||||
<service name="download_src_package">
|
||||
<param name="host">www.dolibarr.org</param>
|
||||
<param name="protocol">http</param>
|
||||
<param name="path">/files/lastbuild/package_rpm_generic/dolibarr-3.3.0-0.2.beta1.src.rpm</param>
|
||||
<param name="path">/files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm</param>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
How to have such a service ?
|
||||
Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/lastbuild/package_rpm_generic/dolibarr-3.3.0-0.2.beta1.src.rpm
|
||||
Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm
|
||||
|
||||
Then add into advanded - attributes
|
||||
OBS:Screenshots http://www.dolibarr.org/images/phocagallery/dolibarr_screenshot1.png
|
||||
OBS:QualityCategory Testing
|
||||
@@ -30,7 +30,7 @@ return "Regis Houssin";
|
||||
# script_dolibarr_versions()
|
||||
sub script_dolibarr_versions
|
||||
{
|
||||
return ( "3.3.0", "3.2.1", "3.1.1" );
|
||||
return ( "3.3.2", "3.3.1", "3.3.0", "3.2.1", "3.1.1" );
|
||||
}
|
||||
|
||||
sub script_dolibarr_category
|
||||
|
||||
@@ -165,7 +165,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
%_datadir/dolibarr/htdocs/commande
|
||||
%_datadir/dolibarr/htdocs/commissions
|
||||
%_datadir/dolibarr/htdocs/compta
|
||||
%_datadir/dolibarr/htdocs/conf
|
||||
%_datadir/dolibarr/htdocs/contact
|
||||
@@ -333,5 +332,5 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Sun Feb 17 2013 Laurent Destailleur 3.3.1-0.3
|
||||
* Mon Apr 22 2013 Laurent Destailleur 3.3.2-0.3
|
||||
- Initial version (#723326)
|
||||
|
||||
@@ -241,7 +241,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
%_datadir/dolibarr/htdocs/commande
|
||||
%_datadir/dolibarr/htdocs/commissions
|
||||
%_datadir/dolibarr/htdocs/compta
|
||||
%_datadir/dolibarr/htdocs/conf
|
||||
%_datadir/dolibarr/htdocs/contact
|
||||
@@ -522,5 +521,5 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Sun Feb 17 2013 Laurent Destailleur 3.3.1-0.3
|
||||
* Mon Apr 22 2013 Laurent Destailleur 3.3.2-0.3
|
||||
- Initial version (#723326)
|
||||
|
||||
@@ -162,7 +162,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
%_datadir/dolibarr/htdocs/commande
|
||||
%_datadir/dolibarr/htdocs/commissions
|
||||
%_datadir/dolibarr/htdocs/compta
|
||||
%_datadir/dolibarr/htdocs/conf
|
||||
%_datadir/dolibarr/htdocs/contact
|
||||
@@ -322,5 +321,5 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Sun Feb 17 2013 Laurent Destailleur 3.3.1-0.3
|
||||
* Mon Apr 22 2013 Laurent Destailleur 3.3.2-0.3
|
||||
- Initial version (#723326)
|
||||
|
||||
@@ -173,7 +173,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/categories
|
||||
%_datadir/dolibarr/htdocs/comm
|
||||
%_datadir/dolibarr/htdocs/commande
|
||||
%_datadir/dolibarr/htdocs/commissions
|
||||
%_datadir/dolibarr/htdocs/compta
|
||||
%_datadir/dolibarr/htdocs/conf
|
||||
%_datadir/dolibarr/htdocs/contact
|
||||
@@ -333,5 +332,5 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Sun Feb 17 2013 Laurent Destailleur 3.3.1-0.3
|
||||
* Mon Apr 22 2013 Laurent Destailleur 3.3.2-0.3
|
||||
- Initial version (#723326)
|
||||
|
||||
@@ -178,7 +178,7 @@ class modMyModule extends DolibarrModules
|
||||
|
||||
|
||||
// Main menu entries
|
||||
$this->menus = array(); // List of menus to add
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r=0;
|
||||
|
||||
// Add here entries to declare new menus
|
||||
|
||||
@@ -58,8 +58,6 @@ require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("Members");
|
||||
|
||||
$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
|
||||
llxHeader('',$langs->trans("MembersSetup"),$help_url);
|
||||
|
||||
@@ -73,7 +71,7 @@ $head = member_admin_prepare_head();
|
||||
dol_fiche_head($head, 'attributes', $langs->trans("Member"), 0, 'user');
|
||||
|
||||
|
||||
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
|
||||
print $langs->trans("DefineHereComplementaryAttributes", $langs->transnoentitiesnoconv("Members")).'<br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
dol_htmloutput_errors($mesg);
|
||||
|
||||
@@ -958,10 +958,11 @@ else
|
||||
$adht = new AdherentType($db);
|
||||
$adht->fetch($object->typeid);
|
||||
|
||||
$country=GETPOST('pays','int');
|
||||
// We set country_id, and country_code, country of the chosen country
|
||||
if (isset($_POST["pays"]) || $object->country_id)
|
||||
if (!empty($country) || $object->country_id)
|
||||
{
|
||||
$sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["pays"])?$_POST["pays"]:$object->country_id);
|
||||
$sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(!empty($country)?$country:$object->country_id);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@@ -76,8 +76,7 @@ $head=agenda_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'attributes', $langs->trans("Agenda"));
|
||||
|
||||
|
||||
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
|
||||
print $langs->trans("DefineHereComplementaryAttributes", $langs->transnoentitiesnoconv("Agenda")).'<br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
dol_htmloutput_errors($mesg);
|
||||
|
||||
@@ -66,7 +66,7 @@ if ($action == 'updateMask')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'specimen')
|
||||
else if ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module','alpha');
|
||||
|
||||
@@ -111,7 +111,8 @@ if ($action == 'specimen')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set')
|
||||
// Activate a model
|
||||
else if ($action == 'set')
|
||||
{
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
@@ -128,7 +129,7 @@ if ($action == 'set')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'del')
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$type='order';
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
|
||||
@@ -142,7 +143,8 @@ if ($action == 'del')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdoc')
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scandir','alpha');
|
||||
@@ -182,7 +184,7 @@ if ($action == 'setdoc')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setmod')
|
||||
else if ($action == 'setmod')
|
||||
{
|
||||
// TODO Verifier si module numerotation choisi peut etre active
|
||||
// par appel methode canBeActivated
|
||||
@@ -190,7 +192,7 @@ if ($action == 'setmod')
|
||||
dolibarr_set_const($db, "COMMANDE_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
|
||||
else if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
|
||||
{
|
||||
$draft = GETPOST("COMMANDE_DRAFT_WATERMARK");
|
||||
$res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
||||
@@ -207,7 +209,7 @@ if ($action == 'set_COMMANDE_DRAFT_WATERMARK')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'set_COMMANDE_FREE_TEXT')
|
||||
else if ($action == 'set_COMMANDE_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST("COMMANDE_FREE_TEXT"); // No alpha here, we want exact string
|
||||
|
||||
@@ -224,6 +226,14 @@ if ($action == 'set_COMMANDE_FREE_TEXT')
|
||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||
}
|
||||
}
|
||||
else if ($action=='setModuleOptions') {
|
||||
if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF_ODT_PATH",GETPOST('value1'),'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->COMMANDE_ADDON_PDF_ODT_PATH = GETPOST('value1');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -139,7 +139,7 @@ $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.t
|
||||
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, p.code as pays_code, p.libelle as pays, a.fk_pays as pays_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_pays as p WHERE a.fk_pays=p.rowid and p.active=1";
|
||||
$tabsql[8] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_typent";
|
||||
$tabsql[9] = "SELECT code_iso as code, label as libelle, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies";
|
||||
$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, llx_c_pays as p WHERE t.fk_pays=p.rowid";
|
||||
$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, p.libelle as pays, p.code as pays_code, t.fk_pays as pays_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p WHERE t.fk_pays=p.rowid";
|
||||
$tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||
$tabsql[12]= "SELECT c.rowid as rowid, code, sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
|
||||
$tabsql[13]= "SELECT id as rowid, code, c.libelle, type, active FROM ".MAIN_DB_PREFIX."c_paiement AS c";
|
||||
@@ -383,7 +383,7 @@ if ($id == 11)
|
||||
|
||||
// Define localtax_typeList (used for dictionnary "c_tva")
|
||||
$localtax_typeList = array();
|
||||
if (GETPOST("id") == 10)
|
||||
if ($id == 10)
|
||||
{
|
||||
$localtax_typeList = array(
|
||||
"0" => $langs->trans("No"),
|
||||
@@ -433,22 +433,33 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
||||
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
|
||||
|
||||
$msg.=$langs->trans("ErrorFieldRequired",$langs->transnoentities($fieldnamekey)).'<br>';
|
||||
$msg.=$langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)).'<br>';
|
||||
}
|
||||
}
|
||||
// Other checks
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"],array('system','systemauto'))) {
|
||||
$ok=0;
|
||||
$msg.="Value 'system' and 'systemauto' for type is reserved. You can use 'user' as value to add your own record.<br>";
|
||||
$msg.= $langs->transnoentities('ErrorReservedTypeSystemSystemAuto').'<br>';
|
||||
}
|
||||
if (isset($_POST["code"]) && $_POST["code"]=='0') {
|
||||
$ok=0;
|
||||
$msg.="Code can't contains value 0<br>";
|
||||
if (isset($_POST["code"]))
|
||||
{
|
||||
if ($_POST["code"]=='0')
|
||||
{
|
||||
$ok=0;
|
||||
$msg.= $langs->transnoentities('ErrorCodeCantContainZero').'<br>';
|
||||
}
|
||||
// FIXME regresion if code with not in numeric base
|
||||
/*if (!is_numeric($_POST['code']))
|
||||
{
|
||||
$ok = 0;
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
|
||||
}*/
|
||||
}
|
||||
if (isset($_POST["pays"]) && $_POST["pays"]=='0') {
|
||||
$ok=0;
|
||||
$msg.=$langs->trans("ErrorFieldRequired",$langs->trans("Country")).'<br>';
|
||||
$msg.=$langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")).'<br>';
|
||||
}
|
||||
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
@@ -510,7 +521,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
else
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$msg=$langs->trans("ErrorRecordAlreadyExists").'<br>';
|
||||
$msg=$langs->transnoentities("ErrorRecordAlreadyExists").'<br>';
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
@@ -580,7 +591,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
$msg='<div class="error">'.$langs->trans("ErrorRecordIsUsedByChild").'</div>';
|
||||
$msg='<div class="error">'.$langs->transnoentities("ErrorRecordIsUsedByChild").'</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -978,6 +989,7 @@ if ($id)
|
||||
$valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') {
|
||||
$langs->load('agenda');
|
||||
$key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
|
||||
$valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
||||
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load('other');
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
@@ -162,6 +162,36 @@ if ($action == 'setdefaultduration')
|
||||
}
|
||||
}
|
||||
|
||||
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
||||
if ($action == 'setModuleOptions')
|
||||
{
|
||||
$post_size=count($_POST);
|
||||
|
||||
$db->begin();
|
||||
|
||||
for($i=0;$i < $post_size;$i++)
|
||||
{
|
||||
if (array_key_exists('param'.$i,$_POST))
|
||||
{
|
||||
$param=GETPOST("param".$i,'alpha');
|
||||
$value=GETPOST("value".$i,'alpha');
|
||||
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*if ($action == 'setusecustomercontactasrecipient')
|
||||
{
|
||||
dolibarr_set_const($db, "PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT",$_POST["value"],'chaine',0,'',$conf->entity);
|
||||
|
||||
@@ -161,7 +161,7 @@ if ($action == 'edit')
|
||||
{
|
||||
$form=new Form($db);
|
||||
|
||||
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=sms_manager">DoliStore</a>').'</div>';
|
||||
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@@ -217,7 +217,7 @@ else
|
||||
{
|
||||
$var=true;
|
||||
|
||||
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=sms_manager">DoliStore</a>').'</div>';
|
||||
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine",'<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
@@ -98,14 +98,14 @@ if ($action == 'set')
|
||||
if ($_POST[$option['constant']])
|
||||
{
|
||||
dolibarr_del_const($db, $option['constant'], 0);
|
||||
dolibarr_set_const($db, $option['constant'], $_POST[$option['constant']], 'chaine');
|
||||
dolibarr_set_const($db, $option['constant'], $_POST[$option['constant']], 'chaine',0, '', 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dolibarr_set_const($db, 'SYSLOG_HANDLERS', json_encode($activeModules), 'chaine');
|
||||
dolibarr_set_const($db, 'SYSLOG_HANDLERS', json_encode($activeModules), 'chaine',0,'',0);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ class Facturation
|
||||
}
|
||||
|
||||
// Define part of HT, VAT, TTC
|
||||
$resultarray=calcul_price_total($this->qte,$this->prix(),$this->remisePercent(),$vat_rate,0,0,0,'HT',$product->type,0);
|
||||
$resultarray=calcul_price_total($this->qte,$this->prix(),$this->remisePercent(),$vat_rate,0,0,0,'HT',0,$product->type,0);
|
||||
|
||||
// Calcul du total ht sans remise
|
||||
$total_ht = $resultarray[0];
|
||||
|
||||
@@ -35,7 +35,7 @@ class ActionComm extends CommonObject
|
||||
public $element='action';
|
||||
public $table_element = 'actioncomm';
|
||||
public $table_rowid = 'id';
|
||||
protected $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
var $id;
|
||||
var $type_id;
|
||||
|
||||
@@ -51,6 +51,21 @@ if ($user->societe_id > 0)
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', '', 'id');
|
||||
|
||||
$act = new ActionComm($db);
|
||||
|
||||
if ($objectid > 0)
|
||||
{
|
||||
$ret = $act->fetch($objectid);
|
||||
if ($ret > 0) {
|
||||
$company=new Societe($db);
|
||||
$company->fetch($act->societe->id);
|
||||
$act->societe=$company; // For backward compatibility
|
||||
$act->thirdparty=$company;
|
||||
}
|
||||
}
|
||||
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
@@ -79,7 +94,7 @@ if ($action == 'delete')
|
||||
{
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid);
|
||||
$file = $upload_dir . '/' . $_GET['urlfile']; // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$ret=dol_delete_file($file);
|
||||
$ret=dol_delete_file($file,0,0,0,$act);
|
||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||
$action='';
|
||||
@@ -96,184 +111,172 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
|
||||
|
||||
if ($objectid > 0)
|
||||
if ($act->id > 0)
|
||||
{
|
||||
$act = new ActionComm($db);
|
||||
if ($act->fetch($objectid))
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid);
|
||||
|
||||
$author=new User($db);
|
||||
$author->fetch($act->author->id);
|
||||
$act->author=$author;
|
||||
|
||||
if ($act->contact->id) $act->fetch_contact($act->contact->id);
|
||||
|
||||
$head=actions_prepare_head($act);
|
||||
dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action');
|
||||
|
||||
// Affichage fiche action en mode visu
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($objectid);
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
|
||||
}
|
||||
|
||||
$company=new Societe($db);
|
||||
$company->fetch($act->societe->id);
|
||||
$act->societe=$company;
|
||||
// Title
|
||||
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>';
|
||||
|
||||
$author=new User($db);
|
||||
$author->fetch($act->author->id);
|
||||
$act->author=$author;
|
||||
// Full day event
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($act->fulldayevent).'</td></tr>';
|
||||
|
||||
if ($act->contact->id) $act->fetch_contact($act->contact->id);
|
||||
// Date start
|
||||
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="2">';
|
||||
if (! $act->fulldayevent) print dol_print_date($act->datep,'dayhour');
|
||||
else print dol_print_date($act->datep,'day');
|
||||
if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td rowspan="4" align="center" valign="middle" width="180">'."\n";
|
||||
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_month">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($act->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendar').' <input type="submit" style="width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_week">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($act->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarweek').' <input type="submit" style="width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_day">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($act->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarday').' <input type="submit" style="width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
|
||||
print '</form>'."\n";
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$head=actions_prepare_head($act);
|
||||
dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action');
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="2">';
|
||||
if (! $act->fulldayevent) print dol_print_date($act->datef,'dayhour');
|
||||
else print dol_print_date($act->datef,'day');
|
||||
if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Affichage fiche action en mode visu
|
||||
print '<table class="border" width="100%">';
|
||||
// Status
|
||||
print '<tr><td nowrap>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="2">';
|
||||
print $act->getLibStatut(4);
|
||||
print '</td></tr>';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
// Location
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="2">'.$act->location.'</td></tr>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($act, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
print '</table><br><br><table class="border" width="100%">';
|
||||
|
||||
|
||||
// Third party - Contact
|
||||
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None"));
|
||||
if ($act->societe->id && $act->type_code == 'AC_TEL')
|
||||
{
|
||||
if ($act->societe->fetch($act->societe->id))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Type").'</td><td colspan="3">'.$act->type.'</td></tr>';
|
||||
print "<br>".dol_print_phone($act->societe->tel);
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$act->label.'</td></tr>';
|
||||
|
||||
// Full day event
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($act->fulldayevent).'</td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="2">';
|
||||
if (! $act->fulldayevent) print dol_print_date($act->datep,'dayhour');
|
||||
else print dol_print_date($act->datep,'day');
|
||||
if ($act->percentage == 0 && $act->datep && $act->datep < ($now - $delay_warning)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td rowspan="4" align="center" valign="middle" width="180">'."\n";
|
||||
print '<form name="listactionsfiltermonth" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_month">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($act->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendar').' <input type="submit" style="width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_week">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($act->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarweek').' <input type="submit" style="width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
|
||||
print '</form>'."\n";
|
||||
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="show_day">';
|
||||
print '<input type="hidden" name="year" value="'.dol_print_date($act->datep,'%Y').'">';
|
||||
print '<input type="hidden" name="month" value="'.dol_print_date($act->datep,'%m').'">';
|
||||
print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
//print '<input type="hidden" name="day" value="'.dol_print_date($act->datep,'%d').'">';
|
||||
print img_picto($langs->trans("ViewCal"),'object_calendarday').' <input type="submit" style="width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">';
|
||||
print '</form>'."\n";
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="2">';
|
||||
if (! $act->fulldayevent) print dol_print_date($act->datef,'dayhour');
|
||||
else print dol_print_date($act->datef,'day');
|
||||
if ($act->percentage > 0 && $act->percentage < 100 && $act->datef && $act->datef < ($now- $delay_warning)) print img_warning($langs->trans("Late"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td nowrap>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="2">';
|
||||
print $act->getLibStatut(4);
|
||||
print '</td></tr>';
|
||||
|
||||
// Location
|
||||
print '<tr><td>'.$langs->trans("Location").'</td><td colspan="2">'.$act->location.'</td></tr>';
|
||||
|
||||
|
||||
print '</table><br><br><table class="border" width="100%">';
|
||||
|
||||
|
||||
// Third party - Contact
|
||||
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($act->societe->id?$act->societe->getNomUrl(1):$langs->trans("None"));
|
||||
if ($act->societe->id && $act->type_code == 'AC_TEL')
|
||||
{
|
||||
if ($act->societe->fetch($act->societe->id))
|
||||
{
|
||||
print "<br>".dol_print_phone($act->societe->tel);
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("Contact").'</td>';
|
||||
print '<td>';
|
||||
if ($act->contact->id > 0)
|
||||
{
|
||||
print $act->contact->getNomUrl(1);
|
||||
if ($act->contact->id && $act->type_code == 'AC_TEL')
|
||||
{
|
||||
if ($act->contact->fetch($act->contact->id))
|
||||
{
|
||||
print "<br>".dol_print_phone($act->contact->phone_pro);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("None");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
if ($act->fk_project)
|
||||
{
|
||||
$project=new Project($db);
|
||||
$project->fetch($act->fk_project);
|
||||
print $project->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Priority
|
||||
print '<tr><td nowrap>'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print ($act->priority?$act->priority:'');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table><br><br><table class="border" width="100%">';
|
||||
|
||||
// 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)
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans("Contact").'</td>';
|
||||
print '<td>';
|
||||
if ($act->contact->id > 0)
|
||||
{
|
||||
print $act->contact->getNomUrl(1);
|
||||
if ($act->contact->id && $act->type_code == 'AC_TEL')
|
||||
{
|
||||
$totalsize+=$file['size'];
|
||||
if ($act->contact->fetch($act->contact->id))
|
||||
{
|
||||
print "<br>".dol_print_phone($act->contact->phone_pro);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '<tr><td width="30%" nowrap>'.$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>';
|
||||
|
||||
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/action/document.php?id='.$act->id,'',0,0,($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create));
|
||||
|
||||
|
||||
// List of document
|
||||
$param='&id='.$act->id;
|
||||
$formfile->list_of_documents($filearray,$act,'actions',$param,0,'',$user->rights->agenda->myactions->create);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
print $langs->trans("None");
|
||||
}
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
if ($act->fk_project)
|
||||
{
|
||||
$project=new Project($db);
|
||||
$project->fetch($act->fk_project);
|
||||
print $project->getNomUrl(1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Priority
|
||||
print '<tr><td nowrap>'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print ($act->priority?$act->priority:'');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table><br><br><table class="border" width="100%">';
|
||||
|
||||
// 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 '<tr><td width="30%" nowrap>'.$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>';
|
||||
|
||||
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/comm/action/document.php?id='.$act->id,'',0,0,($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create),50,$act);
|
||||
|
||||
|
||||
// List of document
|
||||
$param='&id='.$act->id;
|
||||
$formfile->list_of_documents($filearray,$act,'actions',$param,0,'',$user->rights->agenda->myactions->create);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ $contactid=GETPOST('contactid','int');
|
||||
$socid = GETPOST('socid','int');
|
||||
$id = GETPOST('id','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
//$result = restrictedArea($user, 'agenda', $id, 'actioncomm', 'actions', '', 'id');
|
||||
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
|
||||
|
||||
$error=GETPOST("error");
|
||||
$mesg='';
|
||||
@@ -427,7 +427,7 @@ if ($action == 'create')
|
||||
$(".fulldaystartmin").attr("disabled","disabled").val("00");
|
||||
$(".fulldayendhour").attr("disabled","disabled").val("23");
|
||||
$(".fulldayendmin").attr("disabled","disabled").val("59");
|
||||
$("#p2").attr("disabled","disabled").val("");
|
||||
$("#p2").removeAttr("disabled");
|
||||
}
|
||||
}
|
||||
setdatefields();
|
||||
|
||||
@@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
$langs->load("commercial");
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
@@ -38,6 +40,7 @@ if ($user->societe_id > 0)
|
||||
$socid = $user->societe_id;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
|
||||
|
||||
|
||||
/*
|
||||
@@ -48,8 +51,8 @@ $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
|
||||
llxHeader('',$langs->trans("Agenda"),$help_url);
|
||||
|
||||
$act = new ActionComm($db);
|
||||
$act->fetch($_GET["id"]);
|
||||
$act->info($_GET["id"]);
|
||||
$act->fetch($id);
|
||||
$act->info($act->id);
|
||||
|
||||
$head=actions_prepare_head($act);
|
||||
dol_fiche_head($head, 'info', $langs->trans("Action"),0,'action');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -176,7 +176,7 @@ if ($result)
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap"><a href="fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowEMail"),"email").' '.$obj->rowid.'</a></td>';
|
||||
print '<td>'.dol_trunc($obj->titre,38).'</td>';
|
||||
print '<td align="center">'.dol_print_date($obj->date_creat,'day').'</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_creat),'day').'</td>';
|
||||
print '<td align="center">'.($obj->nbemail?$obj->nbemail:"0").'</td>';
|
||||
$mailstatic=new Mailing($db);
|
||||
print '<td align="right">'.$mailstatic->LibStatut($obj->statut,5).'</td>';
|
||||
|
||||
@@ -737,16 +737,16 @@ else if ($action == "addline" && $user->rights->propal->creer)
|
||||
|
||||
$desc=dol_concatdesc($desc,$product_desc);
|
||||
|
||||
// Add custom code and origin country into description
|
||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
|
||||
{
|
||||
$tmptxt='(';
|
||||
if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - ';
|
||||
if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0);
|
||||
$tmptxt.=')';
|
||||
$desc= dol_concatdesc($desc, $tmptxt);
|
||||
}
|
||||
// Add custom code and origin country into description
|
||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
|
||||
{
|
||||
$tmptxt='(';
|
||||
if (! empty($prod->customcode)) $tmptxt.=$langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
|
||||
if (! empty($prod->customcode) && ! empty($prod->country_code)) $tmptxt.=' - ';
|
||||
if (! empty($prod->country_code)) $tmptxt.=$langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code,0,$db,$langs,0);
|
||||
$tmptxt.=')';
|
||||
$desc= dol_concatdesc($desc, $tmptxt);
|
||||
}
|
||||
}
|
||||
|
||||
$type = $prod->type;
|
||||
@@ -1828,7 +1828,7 @@ if ($action == 'presend')
|
||||
{
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
|
||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
||||
$file=$fileparams['fullname'];
|
||||
|
||||
// Build document if it not exists
|
||||
@@ -1851,7 +1851,7 @@ if ($action == 'presend')
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
|
||||
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
||||
$file=$fileparams['fullname'];
|
||||
}
|
||||
|
||||
@@ -1904,4 +1904,4 @@ if ($action == 'presend')
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
?>
|
||||
@@ -310,7 +310,7 @@ class Propal extends CommonObject
|
||||
*
|
||||
* @see add_product
|
||||
*/
|
||||
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='')
|
||||
function addline($propalid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -466,7 +466,7 @@ class Propal extends CommonObject
|
||||
* @param int $type 0/1=Product/service
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $type=0)
|
||||
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -2615,6 +2615,7 @@ class PropaleLigne
|
||||
if (empty($this->info_bits)) $this->info_bits=0;
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
@@ -2631,10 +2632,13 @@ class PropaleLigne
|
||||
|
||||
// Insert line into database
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'propaldet';
|
||||
$sql.= ' (fk_propal, fk_parent_line, label, description, fk_product, product_type, fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
|
||||
$sql.= ' (fk_propal, fk_parent_line, label, description, fk_product, product_type,';
|
||||
$sql.= ' fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
|
||||
$sql.= ' subprice, remise_percent, ';
|
||||
$sql.= ' info_bits, ';
|
||||
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang)';
|
||||
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2,';
|
||||
$sql.= ' total_ttc, fk_product_fournisseur_price, buy_price_ht,';
|
||||
$sql.= ' special_code, rang)';
|
||||
$sql.= " VALUES (".$this->fk_propal.",";
|
||||
$sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").",";
|
||||
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||
@@ -2648,13 +2652,13 @@ class PropaleLigne
|
||||
$sql.= " ".price2num($this->localtax2_tx).",";
|
||||
$sql.= " ".($this->subprice?price2num($this->subprice):'null').",";
|
||||
$sql.= " ".price2num($this->remise_percent).",";
|
||||
$sql.= " '".$this->info_bits."',";
|
||||
$sql.= " ".(isset($this->info_bits)?"'".$this->info_bits."'":"null").",";
|
||||
$sql.= " ".price2num($this->total_ht).",";
|
||||
$sql.= " ".price2num($this->total_tva).",";
|
||||
$sql.= " ".price2num($this->total_localtax1).",";
|
||||
$sql.= " ".price2num($this->total_localtax2).",";
|
||||
$sql.= " ".price2num($this->total_ttc).",";
|
||||
$sql.= " ".(isset($this->fk_fournprice)?"'".$this->fk_fournprice."'":"null").",";
|
||||
$sql.= " ".(!empty($this->fk_fournprice)?"'".$this->fk_fournprice."'":"null").",";
|
||||
$sql.= " ".(isset($this->pa_ht)?"'".price2num($this->pa_ht)."'":"null").",";
|
||||
$sql.= ' '.$this->special_code.',';
|
||||
$sql.= ' '.$this->rang;
|
||||
@@ -2752,6 +2756,7 @@ class PropaleLigne
|
||||
if (empty($this->info_bits)) $this->info_bits=0;
|
||||
if (empty($this->special_code)) $this->special_code=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
|
||||
if (empty($this->fk_parent_line)) $this->fk_fournprice=0;
|
||||
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
@@ -2784,13 +2789,13 @@ class PropaleLigne
|
||||
$sql.= " , total_localtax1=".price2num($this->total_localtax1)."";
|
||||
$sql.= " , total_localtax2=".price2num($this->total_localtax2)."";
|
||||
}
|
||||
$sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'";
|
||||
$sql.= " , buy_price_ht='".price2num($this->pa_ht)."'";
|
||||
$sql.= " , fk_product_fournisseur_price=".(! empty($this->fk_fournprice)?"'".$this->fk_fournprice."'":"null");
|
||||
$sql.= " , buy_price_ht=".price2num($this->pa_ht);
|
||||
if (strlen($this->special_code)) $sql.= " , special_code=".$this->special_code;
|
||||
$sql.= " , fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
|
||||
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
@@ -167,7 +167,7 @@ if ($search_societe)
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
{
|
||||
$sql.= " AND p.total_ht='".$db->escape(trim($search_montant_ht))."'";
|
||||
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
|
||||
}
|
||||
if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%' OR pd.description LIKE '%".$db->escape($sall)."%')";
|
||||
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 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
|
||||
@@ -249,7 +250,7 @@ if ($socid > 0)
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' ('.$num.')</a></td>';
|
||||
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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
|
||||
@@ -244,7 +245,7 @@ if ($resql)
|
||||
llxHeader('',$langs->trans("ThirdParty"),$help_url);
|
||||
}
|
||||
|
||||
$param='&stcomm='.$stcomm.'&search_nom='.urlencode($search_nom).'&search_zipcode='.urlencode($search_code).'&search_ville='.urlencode($search_ville);
|
||||
$param='&stcomm='.$stcomm.'&search_nom='.urlencode($search_nom).'&search_zipcode='.urlencode($search_zipcode).'&search_ville='.urlencode($search_ville);
|
||||
// Added by Matelli
|
||||
// Store the status filter in the URL
|
||||
if (isSet($search_cstc))
|
||||
|
||||
@@ -914,6 +914,12 @@ class Commande extends CommonOrder
|
||||
$line->special_code = $object->lines[$i]->special_code;
|
||||
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
|
||||
|
||||
$line->fk_fournprice = $object->lines[$i]->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
|
||||
$line->pa_ht = $marginInfos[0];
|
||||
$line->marge_tx = $marginInfos[1];
|
||||
$line->marque_tx = $marginInfos[2];
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
}
|
||||
|
||||
|
||||
@@ -2359,7 +2359,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
{
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
||||
$file=$fileparams['fullname'];
|
||||
|
||||
// Build document if it not exists
|
||||
@@ -2382,7 +2382,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
|
||||
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
||||
$file=$fileparams['fullname'];
|
||||
}
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
@@ -51,37 +51,32 @@ $sref = GETPOST('sref');
|
||||
$sref_client = GETPOST('sref_client');
|
||||
$sall = GETPOST('sall');
|
||||
$socid = GETPOST('socid','int');
|
||||
$selected = GETPOST('orders_to_invoice');
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$viewstatut = GETPOST('viewstatut');
|
||||
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
if (! $sortfield) $sortfield='c.rowid';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server
|
||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
$date_starty=dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server
|
||||
$date_endy=dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]);
|
||||
$selected=GETPOST('orders_to_invoice');
|
||||
$action=GETPOST('action','alpha');
|
||||
$now = dol_now();
|
||||
$date_start = dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); // Date for local PHP server
|
||||
$date_end = dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
$date_starty = dol_mktime(0,0,0,$_REQUEST["date_start_delymonth"],$_REQUEST["date_start_delyday"],$_REQUEST["date_start_delyyear"]); // Date for local PHP server
|
||||
$date_endy = dol_mktime(23,59,59,$_REQUEST["date_end_delymonth"],$_REQUEST["date_end_delyday"],$_REQUEST["date_end_delyyear"]);
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if (! is_array($selected))
|
||||
if (is_array($selected) == false)
|
||||
{
|
||||
$mesgs[]='<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>';
|
||||
$mesgs = array('<div class="error">'.$langs->trans('Error_OrderNotChecked').'</div>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$socid=GETPOST('socid');
|
||||
$action=GETPOST('action');
|
||||
$origin=GETPOST('origin');
|
||||
$originid=GETPOST('originid');
|
||||
$origin = GETPOST('origin');
|
||||
$originid = GETPOST('originid');
|
||||
}
|
||||
}
|
||||
$now=dol_now();
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -89,17 +84,12 @@ $viewstatut=GETPOST('viewstatut');
|
||||
|
||||
if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
|
||||
}
|
||||
$langs->load('bills');
|
||||
$langs->load('products');
|
||||
@@ -292,7 +282,9 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
|
||||
$lines[$i]->special_code,
|
||||
$object->origin,
|
||||
$lines[$i]->rowid,
|
||||
$fk_parent_line
|
||||
$fk_parent_line,
|
||||
$lines[$i]->fk_fournprice,
|
||||
$lines[$i]->pa_ht
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
@@ -358,7 +350,7 @@ $formfile = new FormFile($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
// Mode creation
|
||||
if ($action == 'create')
|
||||
if ($action == 'create' && empty($mesgs))
|
||||
{
|
||||
$facturestatic=new Facture($db);
|
||||
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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
|
||||
* the Free Software Foundation; either version 3 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/admin/commissions.php
|
||||
* \ingroup commissions
|
||||
* \brief Page to setup advanced commissions module
|
||||
*/
|
||||
|
||||
include '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/commissions/lib/commissions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php");
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("bills");
|
||||
$langs->load("commissions");
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
if (GETPOST('commissionBase'))
|
||||
{
|
||||
if (dolibarr_set_const($db, 'COMMISSION_BASE', GETPOST('commissionBase'), 'string', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
$conf->global->COMMISSION_BASE = GETPOST('commissionBase');
|
||||
setEventMessage($langs->trans("RecordModifiedSuccessfully"));
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('productCommissionRate'))
|
||||
{
|
||||
if (dolibarr_set_const($db, 'PRODUCT_COMMISSION_RATE', GETPOST('productCommissionRate'), 'rate', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('serviceCommissionRate'))
|
||||
{
|
||||
if (dolibarr_set_const($db, 'SERVICE_COMMISSION_RATE', GETPOST('serviceCommissionRate'), 'rate', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('AGENT_CONTACT_TYPE'))
|
||||
{
|
||||
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
$conf->global->AGENT_CONTACT_TYPE = GETPOST('AGENT_CONTACT_TYPE');
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("CommissionsSetup"));
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("commissionsSetup"),$linkback,'setup');
|
||||
|
||||
|
||||
$head = commissions_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'parameters', $langs->trans("Commissions"), 0, 'commissions');
|
||||
|
||||
print "<br>";
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("MemberMainOptions"),'','');
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="left">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td align="left">'.$langs->trans("Details").'</td>'."\n";
|
||||
print '</tr>';
|
||||
|
||||
$var=true;
|
||||
$form = new Form($db);
|
||||
|
||||
print '<form method="post">';
|
||||
|
||||
// COMMISSION BASE (TURNOVER / MARGIN)
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("CommissionBase").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="radio" name="commissionBase" value="TURNOVER" ';
|
||||
if (isset($conf->global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "TURNOVER")
|
||||
print 'checked';
|
||||
print ' />';
|
||||
print $langs->trans("CommissionBasedOnTurnover");
|
||||
print '<br/>';
|
||||
print '<input type="radio" name="commissionBase" value="MARGIN" ';
|
||||
if (empty($conf->margin->enabled))
|
||||
print 'disabled';
|
||||
elseif (isset($conf->global->COMMISSION_BASE) && $conf->global->COMMISSION_BASE == "MARGIN")
|
||||
print 'checked';
|
||||
print ' />';
|
||||
print $langs->trans("CommissionBasedOnMargins");
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('CommissionBaseDetails');
|
||||
print '<br/>';
|
||||
print $langs->trans('CommissionBasedOnMarginsDetails');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// PRODUCT COMMISSION RATE
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("ProductCommissionRate").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="productCommissionRate" value="'.(! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:'').'" size=6 /> %';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('ProductCommissionRateDetails').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// SERVICE COMMISSION RATE
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("ServiceCommissionRate").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="serviceCommissionRate" value="'.(! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:'').'" size=6 /> %';
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('ServiceCommissionRateDetails').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// INTERNAL CONTACT TYPE USED AS COMMERCIAL AGENT
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("AgentContactType").'</td>';
|
||||
print '<td align="left">';
|
||||
$formcompany = new FormCompany($db);
|
||||
$facture = new Facture($db);
|
||||
print $formcompany->selectTypeContact($facture, $conf->global->AGENT_CONTACT_TYPE, "AGENT_CONTACT_TYPE","internal","code",1);
|
||||
print '</td>';
|
||||
print '<td>'.$langs->trans('AgentContactTypeDetails').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td align="center" colspan="3">';
|
||||
print '<input type="submit" class="button" />';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
@@ -1,329 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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
|
||||
* the Free Software Foundation; either version 3 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/commissions/index.php
|
||||
* \ingroup commissions
|
||||
* \brief Page des commissions par agent commercial
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
if (! empty($conf->margin->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
|
||||
|
||||
$langs->load("companies");
|
||||
$langs->load("bills");
|
||||
$langs->load("products");
|
||||
$langs->load("commissions");
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load("margins");
|
||||
|
||||
// Security check
|
||||
$agentid = GETPOST('agentid','int');
|
||||
|
||||
$mesg = '';
|
||||
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$startdate=$enddate='';
|
||||
|
||||
if (!empty($_POST['startdatemonth']))
|
||||
$startdate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']));
|
||||
if (!empty($_POST['enddatemonth']))
|
||||
$enddate = date('Y-m-d', dol_mktime(12, 0, 0, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']));
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$userstatic = new User($db);
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic=new Facture($db);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("Commissions"));
|
||||
|
||||
$text=$langs->trans("Commissions");
|
||||
print_fiche_titre($text);
|
||||
|
||||
print '<form method="post" name="sel">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
if ($agentid > 0) {
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
|
||||
print '<td colspan="4">';
|
||||
print $form->select_dolusers($agentid,'agentid',1,'',0,'','');
|
||||
print '</td></tr>';
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="s.nom";
|
||||
}
|
||||
else {
|
||||
print '<tr><td width="20%">'.$langs->trans('CommercialAgent').'</td>';
|
||||
print '<td colspan="4">';
|
||||
print $form->select_dolusers('','agentid',1,'',0,'','');
|
||||
print '</td></tr>';
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="u.login";
|
||||
}
|
||||
|
||||
// Start date
|
||||
print '<td>'.$langs->trans('StartDate').'</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($startdate,'startdate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td width="20%">'.$langs->trans('EndDate').'</td>';
|
||||
print '<td width="20%">';
|
||||
$form->select_date($enddate,'enddate','','',1,"sel",1,1);
|
||||
print '</td>';
|
||||
print '<td style="text-align: center;">';
|
||||
print '<input type="submit" value="'.$langs->trans('Launch').'" />';
|
||||
print '</td></tr>';
|
||||
|
||||
// Include unpayed invoices
|
||||
print '<tr><td>'.$langs->trans("IncludeUnpayedInvoices").'</td><td colspan="4">';
|
||||
print '<input id="selIncluded" type="checkbox" name="unpayed" ';
|
||||
if (GETPOST('unpayed') == 'on')
|
||||
print 'checked ';
|
||||
print '/>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Total Margin
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN") {
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
||||
print '<span id="totalBase"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
}
|
||||
elseif ($conf->global->COMMISSION_BASE == "TURNOVER") {
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("TurnoverTotal").'</td><td colspan="4">';
|
||||
print '<span id="totalBase"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Total Commission
|
||||
print '<tr style="font-weight: bold"><td>'.$langs->trans("TotalCommission").'</td><td colspan="4">';
|
||||
print '<span id="totalCommission"></span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
print '</form>';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, s.code_client, s.client, sc.fk_user as agent,";
|
||||
$sql.= " u.login,";
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN") {
|
||||
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) end) as productBase," ;
|
||||
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100)) - d.buy_price_ht) * d.qty) else 0 end) as serviceBase" ;
|
||||
}
|
||||
elseif ($conf->global->COMMISSION_BASE == "TURNOVER") {
|
||||
$sql.= " sum(case d.product_type when 1 then 0 else (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) end) as productBase," ;
|
||||
$sql.= " sum(case d.product_type when 1 then (((d.subprice * (1 - d.remise_percent / 100))) * d.qty) else 0 end) as serviceBase" ;
|
||||
}
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE)?-1:$conf->global->AGENT_CONTACT_TYPE);
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND sc.fk_soc = f.fk_soc";
|
||||
if (! empty($conf->global->AGENT_CONTACT_TYPE))
|
||||
$sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))";
|
||||
else
|
||||
$sql .= " AND sc.fk_user = u.rowid";
|
||||
if (GETPOST('unpayed') == 'on')
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
else
|
||||
$sql.= " AND f.fk_statut > 1";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " AND d.fk_facture = f.rowid";
|
||||
if ($agentid > 0) {
|
||||
if (! empty($conf->global->AGENT_CONTACT_TYPE))
|
||||
$sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = ".$agentid.") OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = ".$agentid."))";
|
||||
else
|
||||
$sql .= " AND sc.fk_user = ".$agentid;
|
||||
}
|
||||
if (!empty($startdate))
|
||||
$sql.= " AND f.datef >= '".$startdate."'";
|
||||
if (!empty($enddate))
|
||||
$sql.= " AND f.datef <= '".$enddate."'";
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||
$sql .= " AND d.buy_price_ht IS NOT NULL";
|
||||
if (($conf->global->COMMISSION_BASE == "MARGIN") && isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
|
||||
$sql .= " AND d.buy_price_ht <> 0";
|
||||
if ($agentid > 0)
|
||||
$sql.= " GROUP BY s.rowid";
|
||||
else
|
||||
$sql.= " GROUP BY u.rowid";
|
||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
print '<br>';
|
||||
print_barre_liste($langs->trans("CommissionDetails"),$page,$_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'');
|
||||
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if ($agentid > 0)
|
||||
print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||
else
|
||||
print_liste_field_titre($langs->trans("CommercialAgent"),$_SERVER["PHP_SELF"],"u.login","","&agentid=".$agentid,'align="center"',$sortfield,$sortorder);
|
||||
|
||||
// product commission
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||
print_liste_field_titre($langs->trans("ProductMargin"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
elseif ($conf->global->COMMISSION_BASE == "TURNOVER")
|
||||
print_liste_field_titre($langs->trans("ProductTurnover"),$_SERVER["PHP_SELF"],"productBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ProductCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
// service commission
|
||||
if ($conf->global->COMMISSION_BASE == "MARGIN")
|
||||
print_liste_field_titre($langs->trans("ServiceMargin"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
elseif ($conf->global->COMMISSION_BASE == "TURNOVER")
|
||||
print_liste_field_titre($langs->trans("ServiceTurnover"),$_SERVER["PHP_SELF"],"serviceBase","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
print_liste_field_titre($langs->trans("CommissionRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ServiceCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
// total commission
|
||||
print_liste_field_titre($langs->trans("TotalCommission"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder);
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$cumul_base_produit = 0;
|
||||
$cumul_base_service = 0;
|
||||
$cumul_commission_produit = 0;
|
||||
$cumul_commission_service = 0;
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
if ($num > 0)
|
||||
{
|
||||
$var=True;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
if ($agentid > 0) {
|
||||
$companystatic->id=$objp->socid;
|
||||
$companystatic->nom=$objp->nom;
|
||||
$companystatic->client=$objp->client;
|
||||
print "<td>".$companystatic->getNomUrl(1,'customer')."</td>\n";
|
||||
}
|
||||
else {
|
||||
$userstatic->id=$objp->agent;
|
||||
$userstatic->login=$objp->login;
|
||||
print "<td>".$userstatic->getLoginUrl(1)."</td>\n";
|
||||
}
|
||||
|
||||
// product commission
|
||||
$productCommissionRate=(! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0);
|
||||
$productBase=(! empty($objp->productBase)?$objp->productBase:0);
|
||||
$productCommission = (! empty($productBase)?($productCommissionRate * $productBase / 100):0);
|
||||
print "<td align=\"right\">".price($productBase)."</td>\n";
|
||||
print "<td align=\"right\">".price($productCommissionRate)."</td>\n";
|
||||
print "<td align=\"right\">".price($productCommission)."</td>\n";
|
||||
|
||||
// service commission
|
||||
$serviceCommissionRate=(! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0);
|
||||
$serviceBase=(! empty($objp->serviceBase)?$objp->serviceBase:0);
|
||||
$serviceCommission = (! empty($serviceBase)?($serviceCommissionRate * $serviceBase / 100):0);
|
||||
print "<td align=\"right\">".price($serviceBase)."</td>\n";
|
||||
print "<td align=\"right\">".price($serviceCommissionRate)."</td>\n";
|
||||
print "<td align=\"right\">".price($serviceCommission)."</td>\n";
|
||||
|
||||
// total commission
|
||||
print "<td align=\"right\">".price($productCommission + $serviceCommission)."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
|
||||
$cumul_base_produit += round($productBase, $rounding);
|
||||
$cumul_base_service += round($serviceBase, $rounding);
|
||||
$cumul_commission_produit += round($productCommission, $rounding);
|
||||
$cumul_commission_service += round($serviceCommission, $rounding);
|
||||
}
|
||||
}
|
||||
|
||||
// affichage totaux commission
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].' style="border-top: 1px solid #ccc; font-weight: bold">';
|
||||
print '<td>';
|
||||
print $langs->trans('Total');
|
||||
print "</td>";
|
||||
// product commission
|
||||
print "<td align=\"right\">".price($cumul_base_produit)."</td>\n";
|
||||
print "<td align=\"right\">".price((! empty($conf->global->PRODUCT_COMMISSION_RATE)?$conf->global->PRODUCT_COMMISSION_RATE:0))."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_commission_produit)."</td>\n";
|
||||
// service commission
|
||||
print "<td align=\"right\">".price($cumul_base_service)."</td>\n";
|
||||
print "<td align=\"right\">".price((! empty($conf->global->SERVICE_COMMISSION_RATE)?$conf->global->SERVICE_COMMISSION_RATE:0))."</td>\n";
|
||||
print "<td align=\"right\">".price($cumul_commission_service)."</td>\n";
|
||||
// total commission
|
||||
print "<td align=\"right\">".price($cumul_commission_produit + $cumul_commission_service)."</td>\n";
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
print "</td>";
|
||||
print "</table>";
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$db->free($result);
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#agentid").change(function() {
|
||||
$("div.fiche form").submit();
|
||||
});
|
||||
|
||||
$("#selIncluded").change(function() {
|
||||
$("div.fiche form").submit();
|
||||
});
|
||||
|
||||
$("#totalBase").html("<?php echo price($cumul_base_produit + $cumul_base_service); ?>");
|
||||
$("#totalCommission").html("<?php echo price($cumul_commission_produit + $cumul_commission_service); ?>");
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.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
|
||||
* the Free Software Foundation; either version 3 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/commissions/lib/commissions.lib.php
|
||||
* \ingroup commissions
|
||||
* \brief Library for common commissions functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define head array for tabs of marges tools setup pages
|
||||
*
|
||||
* @return Array of head
|
||||
*/
|
||||
function commissions_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/commissions/admin/commissions.php';
|
||||
$head[$h][1] = $langs->trans("Parameters");
|
||||
$head[$h][2] = 'parameters';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin');
|
||||
|
||||
complete_head_from_modules($conf,$langs,'',$head,$h,'commissionsadmin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.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
|
||||
@@ -84,7 +84,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$acct->fetch($id, $ref);
|
||||
}
|
||||
|
||||
if (! isset($num))
|
||||
if (empty($num))
|
||||
{
|
||||
/*
|
||||
* Vue liste tous releves confondus
|
||||
|
||||
@@ -140,6 +140,8 @@ if ($resql)
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$langs->load('commercial');
|
||||
|
||||
print_barre_liste($langs->trans("ListOfCustomers"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num);
|
||||
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/discount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
|
||||
@@ -2082,7 +2082,10 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
|
||||
|
||||
$newclassname=$classname;
|
||||
if ($newclassname=='Propal') $newclassname='CommercialProposal';
|
||||
if ($newclassname == 'Propal') $newclassname = 'CommercialProposal';
|
||||
elseif ($newclassname == 'Commande') $newclassname = 'Order';
|
||||
elseif ($newclassname == 'Expedition') $newclassname = 'Sending';
|
||||
|
||||
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
|
||||
@@ -2787,7 +2790,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if (($object->statut == 2 || $object->statut == 3) && $object->close_code == 'discount_vat')
|
||||
{
|
||||
print '<tr><td colspan="'.$nbcols.'" align="right" nowrap="1">';
|
||||
print $form->textwithpicto($langs->trans("Escompte").':',$langs->trans("HelpEscompte"),-1);
|
||||
print $form->textwithpicto($langs->trans("Discount").':',$langs->trans("HelpEscompte"),-1);
|
||||
print '</td><td align="right">'.price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye).'</td><td> </td></tr>';
|
||||
$resteapayeraffiche=0;
|
||||
}
|
||||
@@ -3350,7 +3353,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
$ref = dol_sanitizeFileName($object->ref);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
|
||||
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
||||
$file=$fileparams['fullname'];
|
||||
|
||||
// Build document if it not exists
|
||||
@@ -3373,7 +3376,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
dol_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($object->ref,'/'));
|
||||
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref,'/'));
|
||||
$file=$fileparams['fullname'];
|
||||
}
|
||||
|
||||
|
||||
@@ -1576,7 +1576,7 @@ class Facture extends CommonInvoice
|
||||
$now=dol_now();
|
||||
|
||||
$error=0;
|
||||
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse, LOG_WARNING);
|
||||
dol_syslog(get_class($this).'::validate user='.$user->id.', force_number='.$force_number.', idwarehouse='.$idwarehouse);
|
||||
|
||||
// Check parameters
|
||||
if (! $this->brouillon)
|
||||
@@ -2554,11 +2554,10 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$maxfacnumber = $this->getNextNumRef($this->client,'last');
|
||||
$ventilExportCompta = $this->getVentilExportCompta();
|
||||
// Si derniere facture et si non ventilee, on peut supprimer
|
||||
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
// If there is no invoice into the reset range and not already dispatched, we can delete
|
||||
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1;
|
||||
// If invoice to delete is last one and not already dispatched, we can delete
|
||||
if ($maxfacnumber == $this->ref && $ventilExportCompta == 0) return 1;
|
||||
}
|
||||
else if ($this->statut == 0 && $facref == 'PROV') // Si facture brouillon et provisoire
|
||||
{
|
||||
@@ -2702,10 +2701,21 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$now=dol_now();
|
||||
|
||||
$totalpaye = $this->getSommePaiement();
|
||||
$totalcreditnotes = $this->getSumCreditNotesUsed();
|
||||
$totaldeposits = $this->getSumDepositsUsed();
|
||||
//print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits;
|
||||
|
||||
// We can also use bcadd to avoid pb with floating points
|
||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
$resteapayer = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
|
||||
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
|
||||
$sql .= ' VALUES ('.$this->id;
|
||||
$sql .= ",'".price2num($this->total_ttc)."'";
|
||||
$sql .= ",'".price2num($resteapayer)."'";
|
||||
$sql .= ",".$this->db->idate($now).",".$user->id;
|
||||
$sql .= ",'".$soc->bank_account->code_banque."'";
|
||||
$sql .= ",'".$soc->bank_account->code_guichet."'";
|
||||
@@ -3458,7 +3468,7 @@ class FactureLigne
|
||||
$sql.= ",total_localtax1=".price2num($this->total_localtax1)."";
|
||||
$sql.= ",total_localtax2=".price2num($this->total_localtax2)."";
|
||||
}
|
||||
$sql.= " , fk_product_fournisseur_price='".$this->fk_fournprice."'";
|
||||
$sql.= " , fk_product_fournisseur_price=".(! empty($this->fk_fournprice)?"'".$this->db->escape($this->fk_fournprice)."'":"null");
|
||||
$sql.= " , buy_price_ht='".price2num($this->pa_ht)."'";
|
||||
$sql.= ",fk_parent_line=".($this->fk_parent_line>0?$this->fk_parent_line:"null");
|
||||
if (! empty($this->rang)) $sql.= ", rang=".$this->rang;
|
||||
|
||||
@@ -227,7 +227,7 @@ if ($search_societe) $sql .= " AND s.nom LIKE '%".$search_societe."%'";
|
||||
if ($search_montant_ht) $sql .= " AND f.total = '".$search_montant_ht."'";
|
||||
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$search_montant_ttc."'";
|
||||
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".GETPOST('sf_ref') . "%'";
|
||||
$sql.= " GROUP BY f.facnumber,f.increment,f.total,f.total_ttc,f.datef, f.date_lim_reglement,f.paye, f.rowid, f.fk_statut, f.type,s.nom, s.rowid";
|
||||
$sql.= " GROUP BY s.nom, s.rowid, f.facnumber, f.increment, f.total, f.tva, f.total_ttc, f.datef, f.date_lim_reglement, f.paye, f.rowid, f.fk_statut, f.type ";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql.= " ORDER BY ";
|
||||
$listfield=explode(',',$sortfield);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
@@ -184,11 +184,11 @@ if ($search_societe)
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
{
|
||||
$sql.= ' AND f.total = \''.$db->escape(trim($search_montant_ht)).'\'';
|
||||
$sql.= ' AND f.total = \''.$db->escape(price2num(trim($search_montant_ht))).'\'';
|
||||
}
|
||||
if ($search_montant_ttc)
|
||||
{
|
||||
$sql.= ' AND f.total_ttc = \''.$db->escape(trim($search_montant_ttc)).'\'';
|
||||
$sql.= ' AND f.total_ttc = \''.$db->escape(price2num(trim($search_montant_ttc))).'\'';
|
||||
}
|
||||
if ($month > 0)
|
||||
{
|
||||
@@ -210,7 +210,7 @@ if ($search_user > 0)
|
||||
}
|
||||
if (! $sall)
|
||||
{
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.increment, f.total, f.total_ttc,';
|
||||
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.increment, f.total,f.tva, f.total_ttc,';
|
||||
$sql.= ' f.datef, f.date_lim_reglement,';
|
||||
$sql.= ' f.paye, f.fk_statut, f.note,';
|
||||
$sql.= ' s.nom, s.rowid';
|
||||
|
||||
@@ -404,6 +404,15 @@ if ($object->id > 0)
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="2" nowrap>'.price($object->total_ttc).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
// We can also use bcadd to avoid pb with floating points
|
||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||
//$resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
|
||||
|
||||
print '<tr><td>'.$langs->trans('RemainderToPay').'</td><td align="right" colspan="2" nowrap>'.price($resteapayer).'</td>';
|
||||
print '<td>'.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans('Status').'</td>';
|
||||
print '<td align="left" colspan="3">'.($object->getLibStatut(4,$totalpaye)).'</td></tr>';
|
||||
|
||||
@@ -941,7 +941,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
$sql.= " AND ff.fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, s.nom, s.rowid";
|
||||
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.paye,";
|
||||
$sql.= " s.nom, s.rowid";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
* \ingroup societe, fournisseur, facture
|
||||
* \brief Page with purchases journal
|
||||
*/
|
||||
global $mysoc;
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
@@ -58,7 +60,7 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('','','');
|
||||
llxHeader('',$langs->trans("PurchasesJournal"),'');
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
@@ -94,12 +96,14 @@ $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
|
||||
$idpays = $p[0];
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.libelle,";
|
||||
$sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type,";
|
||||
$sql.= " fd.total_ttc, fd.tva_tx, fd.total_ht, fd.tva as total_tva, fd.product_type, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2,";
|
||||
$sql.= " s.rowid as socid, s.nom as name, s.code_compta_fournisseur,";
|
||||
$sql.= " p.rowid as pid, p.ref as ref, p.accountancy_code_buy,";
|
||||
$sql.= " ct.accountancy_code_buy as account_tva";
|
||||
$sql.= " ct.accountancy_code_buy as account_tva, ctl1.accountancy_code_buy as account_localtax1, ctl2.accountancy_code_buy as account_localtax2";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn_det fd";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl1 ON fd.localtax1_tx = ctl1.localtax1 AND ctl1.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl2 ON fd.localtax2_tx = ctl2.localtax2 AND ctl2.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = fd.fk_product";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."facture_fourn f ON f.rowid = fd.fk_facture_fourn";
|
||||
$sql.= " JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid = f.fk_soc" ;
|
||||
@@ -120,6 +124,8 @@ if ($result)
|
||||
$tabht = array();
|
||||
$tabtva = array();
|
||||
$tabttc = array();
|
||||
$tablocaltax1 = array();
|
||||
$tablocaltax2 = array();
|
||||
$tabcompany = array();
|
||||
|
||||
$i=0;
|
||||
@@ -135,6 +141,8 @@ if ($result)
|
||||
else $compta_prod = (! empty($conf->global->COMPTA_SERVICE_BUY_ACCOUNT)?$conf->global->COMPTA_SERVICE_BUY_ACCOUNT:$langs->trans("CodeNotDef"));
|
||||
}
|
||||
$compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva);
|
||||
$compta_localtax1 = (! empty($obj->account_localtax1)?$obj->account_localtax1:$langs->trans("CodeNotDef"));
|
||||
$compta_localtax2 = (! empty($obj->account_localtax2)?$obj->account_localtax2:$langs->trans("CodeNotDef"));
|
||||
|
||||
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
@@ -143,6 +151,8 @@ if ($result)
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||
$tabcompany[$obj->rowid]=array('id'=>$obj->socid,'name'=>$obj->name);
|
||||
|
||||
$i++;
|
||||
@@ -193,7 +203,6 @@ foreach ($tabfac as $key => $val)
|
||||
}
|
||||
}
|
||||
// vat
|
||||
//var_dump($tabtva);
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
@@ -202,12 +211,42 @@ foreach ($tabfac as $key => $val)
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$langs->trans("VAT")." ".$key."</td>";
|
||||
print "<td>".$k."</td><td>".$langs->trans("VAT")."</td>";
|
||||
print '<td align="right">'.($mt>=0?price($mt):'')."</td>";
|
||||
print '<td align="right">'.($mt<0?price(-$mt):'')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
// localtax1
|
||||
foreach ($tablocaltax1[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$langs->transcountrynoentities("LT1",$mysoc->country_code)."</td>";
|
||||
print "<td align='right'>".($mt>=0?price($mt):'')."</td>";
|
||||
print "<td align='right'>".($mt<0?price(-$mt):'')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
// localtax2
|
||||
foreach ($tablocaltax2[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k."</td><td>".$langs->transcountrynoentities("LT2",$mysoc->country_code)."</td>";
|
||||
print "<td align='right'>".($mt>=0?price($mt):'')."</td>";
|
||||
print "<td align='right'>".($mt<0?price(-$mt):'')."</td>";
|
||||
print "</tr>";
|
||||
}
|
||||
}
|
||||
print "<tr ".$bc[$var].">";
|
||||
// third party
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_BUY."</td>";
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2012 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 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
|
||||
@@ -24,6 +25,8 @@
|
||||
* \ingroup societe, facture
|
||||
* \brief Page with sells journal
|
||||
*/
|
||||
global $mysoc;
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
@@ -42,10 +45,10 @@ $date_endmonth=GETPOST('date_endmonth');
|
||||
$date_endday=GETPOST('date_endday');
|
||||
$date_endyear=GETPOST('date_endyear');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
|
||||
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
|
||||
// Security check
|
||||
if ($user->societe_id > 0) $socid = $user->societe_id;
|
||||
if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat');
|
||||
if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@@ -96,15 +99,17 @@ $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_PAYS);
|
||||
$idpays = $p[0];
|
||||
|
||||
$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.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2,";
|
||||
$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_sell as account_tva";
|
||||
$sql.= " ct.accountancy_code_sell as account_tva, ctl1.accountancy_code_sell as account_localtax1, ctl2.accountancy_code_sell as account_localtax2";
|
||||
$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.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl1 ON fd.localtax1_tx = ctl1.localtax1 AND ctl1.fk_pays = '".$idpays."'";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_tva ctl2 ON fd.localtax2_tx = ctl2.localtax2 AND ctl2.fk_pays = '".$idpays."'";
|
||||
$sql.= " WHERE f.entity = ".$conf->entity;
|
||||
$sql.= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)";
|
||||
@@ -119,6 +124,8 @@ if ($result)
|
||||
$tabfac = array();
|
||||
$tabht = array();
|
||||
$tabtva = array();
|
||||
$tablocaltax1 = array();
|
||||
$tablocaltax2 = array();
|
||||
$tabttc = array();
|
||||
$tabcompany = array();
|
||||
|
||||
@@ -139,6 +146,8 @@ if ($result)
|
||||
}
|
||||
$cpttva = (! empty($conf->global->COMPTA_VAT_ACCOUNT)?$conf->global->COMPTA_VAT_ACCOUNT:$langs->trans("CodeNotDef"));
|
||||
$compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva);
|
||||
$compta_localtax1 = (! empty($obj->account_localtax1)?$obj->account_localtax1:$langs->trans("CodeNotDef"));
|
||||
$compta_localtax2 = (! empty($obj->account_localtax2)?$obj->account_localtax2:$langs->trans("CodeNotDef"));
|
||||
|
||||
//la ligne facture
|
||||
$tabfac[$obj->rowid]["date"] = $obj->datef;
|
||||
@@ -147,9 +156,13 @@ if ($result)
|
||||
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc]=0;
|
||||
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod]=0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva])) $tabtva[$obj->rowid][$compta_tva]=0;
|
||||
if (! isset($tablocaltax1[$obj->rowid][$compta_localtax1])) $tablocaltax1[$obj->rowid][$compta_localtax1]=0;
|
||||
if (! isset($tablocaltax2[$obj->rowid][$compta_localtax2])) $tablocaltax2[$obj->rowid][$compta_localtax2]=0;
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tablocaltax1[$obj->rowid][$compta_localtax1] += $obj->total_localtax1;
|
||||
$tablocaltax2[$obj->rowid][$compta_localtax2] += $obj->total_localtax2;
|
||||
$tabcompany[$obj->rowid]=array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client);
|
||||
$i++;
|
||||
}
|
||||
@@ -215,7 +228,6 @@ foreach ($tabfac as $key => $val)
|
||||
}
|
||||
}
|
||||
// vat
|
||||
//var_dump($tabtva);
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
@@ -228,6 +240,32 @@ foreach ($tabfac as $key => $val)
|
||||
print "</td><td>".$langs->trans("VAT")."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
||||
}
|
||||
}
|
||||
// localtax1
|
||||
foreach ($tablocaltax1[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k;
|
||||
print "</td><td>".$langs->transcountrynoentities("LT1",$mysoc->country_code)."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
||||
}
|
||||
}
|
||||
// localtax2
|
||||
foreach ($tablocaltax2[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
print "<tr ".$bc[$var].">";
|
||||
//print "<td>".$conf->global->COMPTA_JOURNAL_SELL."</td>";
|
||||
print "<td>".$val["date"]."</td>";
|
||||
print "<td>".$invoicestatic->getNomUrl(1)."</td>";
|
||||
print "<td>".$k;
|
||||
print "</td><td>".$langs->transcountrynoentities("LT2",$mysoc->country_code)."</td><td align='right'>".($mt<0?price(-$mt):'')."</td><td align='right'>".($mt>=0?price($mt):'')."</td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
$var = !$var;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
require '../bank/pre.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
|
||||
$langs->load("widthdrawals");
|
||||
$langs->load("withdrawals");
|
||||
$langs->load("categories");
|
||||
|
||||
// Security check
|
||||
|
||||
@@ -426,14 +426,14 @@ class BonPrelevement extends CommonObject
|
||||
$facs = array();
|
||||
$amounts = array();
|
||||
|
||||
$facs = $this->getListInvoices();
|
||||
$facs = $this->getListInvoices(1);
|
||||
|
||||
$num=count($facs);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$fac = new Facture($this->db);
|
||||
$fac->fetch($facs[$i]);
|
||||
$amounts[$fac->id] = $fac->total_ttc;
|
||||
$fac->fetch($facs[$i][0]);
|
||||
$amounts[$fac->id] = $facs[$i][1];
|
||||
$result = $fac->set_paid($user);
|
||||
}
|
||||
$paiement = new Paiement($this->db);
|
||||
@@ -576,9 +576,10 @@ class BonPrelevement extends CommonObject
|
||||
/**
|
||||
* Get invoice list
|
||||
*
|
||||
* @param $amounts If you want to get the amount of the order for each invoice
|
||||
* @return array id of invoices
|
||||
*/
|
||||
private function getListInvoices()
|
||||
private function getListInvoices($amounts=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -589,6 +590,7 @@ class BonPrelevement extends CommonObject
|
||||
* dans un bon de prelevement
|
||||
*/
|
||||
$sql = "SELECT fk_facture";
|
||||
if ($amounts) $sql .= ", SUM(pl.amount)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."prelevement_facture as pf";
|
||||
@@ -596,6 +598,7 @@ class BonPrelevement extends CommonObject
|
||||
$sql.= " AND pl.fk_prelevement_bons = p.rowid";
|
||||
$sql.= " AND p.rowid = ".$this->id;
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if ($amounts) $sql.= " GROUP BY fk_facture";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@@ -608,7 +611,14 @@ class BonPrelevement extends CommonObject
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $this->db->fetch_row($resql);
|
||||
$arr[$i] = $row[0];
|
||||
if (!$amounts) $arr[$i] = $row[0];
|
||||
else
|
||||
{
|
||||
$arr[$i] = array(
|
||||
$row[0],
|
||||
$row[1]
|
||||
);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2013 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
|
||||
@@ -50,7 +50,7 @@ class RejetPrelevement
|
||||
$this->motifs = array();
|
||||
$this->facturer = array();
|
||||
|
||||
$this->motifs[0] = $langs->trans("StatusMotif0");
|
||||
$this->motifs[0] = ""; //$langs->trans("StatusMotif0");
|
||||
$this->motifs[1] = $langs->trans("StatusMotif1");
|
||||
$this->motifs[2] = $langs->trans("StatusMotif2");
|
||||
$this->motifs[3] = $langs->trans("StatusMotif3");
|
||||
|
||||
@@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
$langs->load("companies");
|
||||
$langs->load("categories");
|
||||
$langs->load('withdrawals');
|
||||
$langs->load('bills');
|
||||
|
||||
// Securite acces client
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
|
||||
$langs->load("categories");
|
||||
$langs->load('withdrawals');
|
||||
$langs->load('bills');
|
||||
|
||||
// Securite acces client
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
@@ -33,6 +33,7 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
$langs->load("withdrawals");
|
||||
$langs->load("categories");
|
||||
$langs->load('bills');
|
||||
|
||||
// Get supervariables
|
||||
$prev_id = GETPOST('id','int');
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2013 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
|
||||
@@ -50,29 +50,49 @@ if ($action == 'confirm_rejet')
|
||||
{
|
||||
if ( GETPOST("confirm") == 'yes')
|
||||
{
|
||||
$daterej = mktime(2, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
|
||||
|
||||
$lipre = new LignePrelevement($db, $user);
|
||||
|
||||
if ($lipre->fetch($id) == 0)
|
||||
if (GETPOST('remonth','int'))
|
||||
{
|
||||
$daterej = mktime(2, 0, 0, GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int'));
|
||||
}
|
||||
|
||||
if (GETPOST('motif','alpha') > 0 && $daterej < time())
|
||||
if (empty($daterej))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")),'errors');
|
||||
}
|
||||
|
||||
elseif ($daterej > dol_now())
|
||||
{
|
||||
$error++;
|
||||
$langs->load("error");
|
||||
setEventMessage($langs->transnoentities("ErrorDateMustBeBeforeToday"),'errors');
|
||||
}
|
||||
|
||||
if (GETPOST('motif','alpha') == 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefusedReason")),'errors');
|
||||
}
|
||||
|
||||
if ( ! $error )
|
||||
{
|
||||
$lipre = new LignePrelevement($db, $user);
|
||||
|
||||
if ($lipre->fetch($id) == 0)
|
||||
|
||||
{
|
||||
$rej = new RejetPrelevement($db, $user);
|
||||
|
||||
|
||||
$rej->create($user, $id, GETPOST('motif','alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer','int'));
|
||||
|
||||
header("Location: ligne.php?id=".$id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Motif : ".GETPOST('motif','alpha'));
|
||||
dol_syslog("$daterej $time ");
|
||||
header("Location: ligne.php?id=".$id."&action=rejet");
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$action="rejet";
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -173,13 +193,13 @@ if ($id)
|
||||
print '</td></tr>';
|
||||
|
||||
//Date
|
||||
print '<tr><td class="valid">'.$langs->trans("RefusedData").'</td>';
|
||||
print '<tr><td class="fieldrequired" class="valid">'.$langs->trans("RefusedData").'</td>';
|
||||
print '<td colspan="2" class="valid">';
|
||||
print $form->select_date('','','','','',"confirm_rejet");
|
||||
print '</td></tr>';
|
||||
|
||||
//Reason
|
||||
print '<tr><td class="valid">'.$langs->trans("RefusedReason").'</td>';
|
||||
print '<tr><td class="fieldrequired" class="valid">'.$langs->trans("RefusedReason").'</td>';
|
||||
print '<td class="valid">';
|
||||
print $form->selectarray("motif", $rej->motifs);
|
||||
print '</td></tr>';
|
||||
@@ -303,8 +323,9 @@ if ($id)
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@@ -36,6 +36,7 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
$langs->load("categories");
|
||||
$langs->load('withdrawals');
|
||||
$langs->load('bills');
|
||||
|
||||
// Get supervariables
|
||||
$prev_id = GETPOST('id','int');
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
require '../bank/pre.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
|
||||
$langs->load("withdrawals");
|
||||
@@ -56,6 +57,7 @@ if ($sortorder == "") $sortorder="DESC";
|
||||
if ($sortfield == "") $sortfield="p.datec";
|
||||
|
||||
$rej = new RejetPrelevement($db, $user);
|
||||
$ligne = new LignePrelevement($db);
|
||||
|
||||
/*
|
||||
* Liste des factures
|
||||
@@ -84,7 +86,7 @@ if ($result)
|
||||
print"\n<!-- debut table -->\n";
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Nb"),"rejets.php","p.ref",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("Line"),"rejets.php","p.ref",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),"rejets.php","s.nom",'',$urladd);
|
||||
print_liste_field_titre($langs->trans("Reason"),"rejets.php","pr.motif","",$urladd);
|
||||
print '</tr>';
|
||||
@@ -98,7 +100,7 @@ if ($result)
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print "<tr $bc[$var]><td>";
|
||||
print '<img border="0" src="./img/statut'.$obj->statut.'.png"></a> ';
|
||||
print $ligne->LibStatut($obj->statut,2).' ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
|
||||
print substr('000000'.$obj->rowid, -6)."</a></td>";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.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
|
||||
|
||||
@@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
*/
|
||||
class ChargeSociales extends CommonObject
|
||||
{
|
||||
public $element='rowid';
|
||||
public $element='chargesociales';
|
||||
public $table='chargesociales';
|
||||
public $table_element='chargesociales';
|
||||
|
||||
@@ -115,6 +115,8 @@ class ChargeSociales extends CommonObject
|
||||
*/
|
||||
function create($user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// Nettoyage parametres
|
||||
$newamount=price2num($this->amount,'MT');
|
||||
|
||||
@@ -127,10 +129,11 @@ class ChargeSociales extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount)";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, libelle, date_ech, periode, amount, entity)";
|
||||
$sql.= " VALUES (".$this->type.",'".$this->db->escape($this->lib)."',";
|
||||
$sql.= " '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."',";
|
||||
$sql.= " ".price2num($newamount);
|
||||
$sql.= " '".price2num($newamount)."',";
|
||||
$sql.= " ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create sql=".$sql);
|
||||
|
||||
@@ -79,7 +79,7 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$file = $upload_dir . '/' . GETPOST("urlfile"); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
$ret=dol_delete_file($file);
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||
}
|
||||
@@ -172,7 +172,7 @@ if ($object->id)
|
||||
|
||||
// Affiche formulaire upload
|
||||
$formfile=new FormFile($db);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id,'',0,0,$user->rights->tax->charges->creer);
|
||||
$formfile->form_attach_new_file(DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id,'',0,0,$user->rights->tax->charges->creer,50,$object);
|
||||
|
||||
|
||||
// List of document
|
||||
|
||||
@@ -500,13 +500,13 @@ class Tva extends CommonObject
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva (datep, datev, amount";
|
||||
if ($this->note) $sql.=", note";
|
||||
if ($this->label) $sql.=", label";
|
||||
$sql.= ", fk_user_creat, fk_bank";
|
||||
$sql.= ", fk_user_creat, fk_bank, entity";
|
||||
$sql.= ") ";
|
||||
$sql.= " VALUES ('".$this->db->idate($this->datep)."',";
|
||||
$sql.= "'".$this->db->idate($this->datev)."'," . $this->amount;
|
||||
if ($this->note) $sql.=", '".$this->db->escape($this->note)."'";
|
||||
if ($this->label) $sql.=", '".$this->db->escape($this->label)."'";
|
||||
$sql.=", '".$user->id."', NULL";
|
||||
$sql.=", '".$user->id."', NULL, ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog("Tva::addPayment sql=".$sql);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.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
|
||||
|
||||
@@ -35,6 +35,7 @@ class Contact extends CommonObject
|
||||
{
|
||||
public $element='contact';
|
||||
public $table_element='socpeople';
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
var $id;
|
||||
var $civilite_id; // In fact we stor civility_code
|
||||
@@ -245,11 +246,11 @@ class Contact extends CommonObject
|
||||
$sql .= ", poste='".$this->db->escape($this->poste)."'";
|
||||
$sql .= ", fax='".$this->db->escape($this->fax)."'";
|
||||
$sql .= ", email='".$this->db->escape($this->email)."'";
|
||||
$sql .= ", note='".$this->db->escape($this->note)."'";
|
||||
$sql .= ", phone = '".$this->db->escape($this->phone_pro)."'";
|
||||
$sql .= ", phone_perso = '".$this->db->escape($this->phone_perso)."'";
|
||||
$sql .= ", phone_mobile = '".$this->db->escape($this->phone_mobile)."'";
|
||||
$sql .= ", jabberid = '".$this->db->escape($this->jabberid)."'";
|
||||
$sql .= ", note = ".(isset($this->note)?"'".$this->db->escape($this->note)."'":"null");
|
||||
$sql .= ", phone = ".(isset($this->phone_pro)?"'".$this->db->escape($this->phone_pro)."'":"null");
|
||||
$sql .= ", phone_perso = ".(isset($this->phone_perso)?"'".$this->db->escape($this->phone_perso)."'":"null");
|
||||
$sql .= ", phone_mobile = ".(isset($this->phone_mobile)?"'".$this->db->escape($this->phone_mobile)."'":"null");
|
||||
$sql .= ", jabberid = ".(isset($this->jabberid)?"'".$this->db->escape($this->jabberid)."'":"null");
|
||||
$sql .= ", priv = '".$this->priv."'";
|
||||
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$user->id."'":"null");
|
||||
$sql .= ", default_lang=".($this->default_lang?"'".$this->default_lang."'":"null");
|
||||
@@ -745,7 +746,7 @@ class Contact extends CommonObject
|
||||
$this->error=$this->db->error().' sql='.$sql;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Removed extrafields
|
||||
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) { // For avoid conflicts if trigger used
|
||||
$result=$this->deleteExtraFields($this);
|
||||
|
||||
@@ -29,26 +29,28 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
|
||||
$langs->load("companies");
|
||||
|
||||
// Security check
|
||||
$contactid = isset($_GET["id"])?$_GET["id"]:'';
|
||||
$id = GETPOST('id', 'int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($_GET["id"], $user);
|
||||
$contact->fetch($id, $user);
|
||||
|
||||
|
||||
$head = contact_prepare_head($contact);
|
||||
|
||||
dol_fiche_head($head, 'exportimport', $langs->trans("ContactsAddresses"), 0, 'contact');
|
||||
dol_fiche_head($head, 'exportimport', $title, 0, 'contact');
|
||||
|
||||
|
||||
/*
|
||||
@@ -97,7 +99,7 @@ print '</div>';
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("ExportCardToFormat").': ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$_GET["id"].'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/contact/vcard.php?id='.$contact->id.'">';
|
||||
print img_picto($langs->trans("VCard"),'vcard.png').' ';
|
||||
print $langs->trans("VCard");
|
||||
print '</a>';
|
||||
|
||||
@@ -62,7 +62,7 @@ if (! empty($canvas))
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', '', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe', '', '', 'rowid', $objcanvas); // If we create a contact with no company (shared contacts), no check on write permission
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
|
||||
@@ -35,12 +35,12 @@ $langs->load("admin");
|
||||
$action=GETPOST('action');
|
||||
|
||||
// Security check
|
||||
$contactid = isset($_GET["id"])?$_GET["id"]:'';
|
||||
$id = GETPOST('id', 'int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contact', $contactid, 'socpeople&societe');
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($_GET["id"], $user);
|
||||
$contact->fetch($id, $user);
|
||||
|
||||
|
||||
/*
|
||||
@@ -79,13 +79,15 @@ if ($action == 'dolibarr2ldap')
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$head = contact_prepare_head($contact);
|
||||
|
||||
dol_fiche_head($head, 'ldap', $langs->trans("ContactsAddresses"), 0, 'contact');
|
||||
dol_fiche_head($head, 'ldap', $title, 0, 'contact');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@@ -69,7 +69,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
llxHeader('',$langs->trans("ContactsAddresses"),'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
@@ -77,7 +79,7 @@ $object->fetch($id, $user);
|
||||
|
||||
$head = contact_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'perso', $langs->trans("ContactsAddresses"), 0, 'contact');
|
||||
dol_fiche_head($head, 'perso', $title, 0, 'contact');
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
|
||||
@@ -29,8 +29,13 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/vcard.class.php';
|
||||
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
|
||||
$contact = new Contact($db);
|
||||
$result=$contact->fetch($_GET["id"]);
|
||||
$result=$contact->fetch($id);
|
||||
|
||||
$physicalperson=1;
|
||||
|
||||
|
||||
@@ -524,20 +524,20 @@ class Contrat extends CommonObject
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
$line = new ContratLigne($this->db);
|
||||
$line->id = $objp->rowid;
|
||||
$line->id = $objp->rowid;
|
||||
$line->fk_contrat = $objp->fk_contrat;
|
||||
$line->libelle = $objp->description;
|
||||
$line->desc = $objp->description;
|
||||
$line->qty = $objp->qty;
|
||||
$line->statut = $objp->statut;
|
||||
$line->ref = $objp->ref;
|
||||
$line->statut = $objp->statut;
|
||||
$line->ref = (isset($objp->ref)?$objp->ref:NULL);
|
||||
$line->tva_tx = $objp->tva_tx;
|
||||
$line->localtax1_tx = $objp->localtax1_tx;
|
||||
$line->localtax2_tx = $objp->localtax2_tx;
|
||||
$line->subprice = $objp->subprice;
|
||||
$line->remise_percent = $objp->remise_percent;
|
||||
$line->price_ht = $objp->price_ht;
|
||||
$line->price = $objp->price; // For backward compatibility
|
||||
$line->price = (isset($objp->price)?$objp->price:NULL); // For backward compatibility
|
||||
$line->total_ht = $objp->total_ht;
|
||||
$line->total_tva = $objp->total_tva;
|
||||
$line->total_localtax1= $objp->total_localtax1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -96,7 +96,7 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$now=dol_now();
|
||||
|
||||
$i = 0;
|
||||
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
|
||||
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@@ -105,7 +105,7 @@ class box_factures_fourn extends ModeleBoxes
|
||||
$datec=$db->jdate($objp->datec);
|
||||
|
||||
$late = '';
|
||||
if ($objp->paye == 0 && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
|
||||
if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
|
||||
|
||||
$this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"',
|
||||
'logo' => $this->boximg,
|
||||
|
||||
@@ -82,6 +82,7 @@ class box_produits_alerte_stock extends ModeleBoxes
|
||||
$sql.= " AND p.tosell = 1";
|
||||
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
|
||||
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
|
||||
$sql.= " GROUP BY p.rowid, p.seuil_stock_alerte, s.reel";
|
||||
$sql.= " HAVING s.reel < p.seuil_stock_alerte";
|
||||
$sql.= $db->order('s.reel', 'DESC');
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
@@ -2632,7 +2632,7 @@ abstract class CommonObject
|
||||
*/
|
||||
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0, $hookmanager=false)
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf,$langs,$user;
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
|
||||
@@ -2646,7 +2646,7 @@ abstract class CommonObject
|
||||
print '<td align="right" width="80"> </td>';
|
||||
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
|
||||
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
|
||||
if (! empty($conf->margin->enabled)) {
|
||||
if (! empty($conf->margin->enabled) && empty($user->societe_id)) {
|
||||
if ($conf->global->MARGIN_TYPE == "1")
|
||||
print '<td align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
|
||||
else
|
||||
@@ -3044,7 +3044,8 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
function displayMarginInfos($force_price=false) {
|
||||
global $langs, $conf;
|
||||
global $langs, $conf,$user;
|
||||
if (! empty($user->societe_id)) return;
|
||||
$marginInfo = $this->getMarginInfos($force_price);
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
@@ -341,7 +341,8 @@ class Conf
|
||||
|
||||
// societe
|
||||
if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard";
|
||||
if (empty($this->global->SOCIETE_CODEFOURNISSEUR_ADDON)) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->SOCIETE_CODECLIENT_ADDON;
|
||||
// Unused constant and for avoid problem with multicompany sharing
|
||||
//if (empty($this->global->SOCIETE_CODEFOURNISSEUR_ADDON)) $this->global->SOCIETE_CODEFOURNISSEUR_ADDON=$this->global->SOCIETE_CODECLIENT_ADDON;
|
||||
if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum";
|
||||
|
||||
// Security
|
||||
@@ -409,7 +410,7 @@ class Conf
|
||||
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024);
|
||||
|
||||
// Define list of limited modules
|
||||
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
||||
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
||||
|
||||
// Timeouts
|
||||
if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10;
|
||||
|
||||
@@ -56,6 +56,8 @@ class FileUpload
|
||||
$filename = $regs[2];
|
||||
}
|
||||
|
||||
$parentForeignKey = '';
|
||||
|
||||
// For compatibility
|
||||
if ($element == 'propal') {
|
||||
$pathname = 'comm/propal';
|
||||
@@ -69,6 +71,14 @@ class FileUpload
|
||||
$element = $pathname = 'projet';
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
}
|
||||
elseif ($element == 'project_task') {
|
||||
$pathname = 'projet'; $filename='task';
|
||||
$dir_output=$conf->projet->dir_output;
|
||||
$parentForeignKey = 'fk_project';
|
||||
$parentClass = 'Project';
|
||||
$parentElement = 'projet';
|
||||
$parentObject = 'project';
|
||||
}
|
||||
elseif ($element == 'fichinter') {
|
||||
$element='ficheinter';
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
@@ -80,6 +90,17 @@ class FileUpload
|
||||
elseif ($element == 'invoice_supplier') {
|
||||
$pathname = 'fourn'; $filename='fournisseur.facture';
|
||||
$dir_output=$conf->fournisseur->facture->dir_output;
|
||||
}
|
||||
elseif ($element == 'product') {
|
||||
$dir_output = $conf->product->multidir_output[$conf->entity];
|
||||
}
|
||||
elseif ($element == 'action') {
|
||||
$pathname = 'comm/action'; $filename='actioncomm';
|
||||
$dir_output=$conf->agenda->dir_output;
|
||||
}
|
||||
elseif ($element == 'chargesociales') {
|
||||
$pathname = 'compta/sociales'; $filename='chargesociales';
|
||||
$dir_output=$conf->tax->dir_output;
|
||||
} else {
|
||||
$dir_output=$conf->$element->dir_output;
|
||||
}
|
||||
@@ -97,11 +118,23 @@ class FileUpload
|
||||
$object = new $classname($db);
|
||||
|
||||
$object->fetch($fk_element);
|
||||
$object->fetch_thirdparty();
|
||||
if (!empty($parentForeignKey)) {
|
||||
dol_include_once('/'.$parentElement.'/class/'.$parentObject.'.class.php');
|
||||
$parent = new $parentClass($db);
|
||||
$parent->fetch($object->$parentForeignKey);
|
||||
if (!empty($parent->socid)) {
|
||||
$parent->fetch_thirdparty();
|
||||
}
|
||||
$object->$parentObject = dol_clone($parent);
|
||||
} else {
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$object_ref = dol_sanitizeFileName($object->ref);
|
||||
if ($element == 'invoice_supplier') {
|
||||
$object_ref = get_exdir($object->id, 2) . $object_ref;
|
||||
} else if ($element == 'project_task') {
|
||||
$object_ref = $object->project->ref . '/' . $object_ref;
|
||||
}
|
||||
|
||||
$this->options = array(
|
||||
@@ -436,7 +469,7 @@ class FileUpload
|
||||
{
|
||||
file_put_contents($file_path, fopen($uploaded_file, 'r'), FILE_APPEND);
|
||||
} else {
|
||||
dol_move_uploaded_file($uploaded_file, $file_path, 1);
|
||||
dol_move_uploaded_file($uploaded_file, $file_path, 1, 0, 0, 0, 'userfile');
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -168,7 +168,7 @@ class HookManager
|
||||
|
||||
$result = $actionclassinstance->$method($parameters, $object, $action, $this);
|
||||
|
||||
if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
|
||||
|
||||
// TODO. remove this. array result must be set into $actionclassinstance->results
|
||||
@@ -177,7 +177,7 @@ class HookManager
|
||||
if (! is_array($result) && ! is_numeric($result)) $this->resPrint.=$result;
|
||||
}
|
||||
|
||||
//print "method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction;
|
||||
//print "method=".$method." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." result=".$result." resaction=".$resaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ class Form
|
||||
{
|
||||
//$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2);
|
||||
$out.= ajax_combobox($htmlname, $event, $conf->global->COMPANY_USE_SEARCH_TO_SELECT);
|
||||
/*
|
||||
/*
|
||||
if ($selected && empty($selected_input_value))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
@@ -3395,7 +3395,7 @@ class Form
|
||||
}
|
||||
|
||||
// Show date with combo selects
|
||||
if (empty($conf->use_javascript_ajax) || $conf->global->MAIN_POPUP_CALENDAR == "none")
|
||||
if (empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_POPUP_CALENDAR) && $conf->global->MAIN_POPUP_CALENDAR == "none"))
|
||||
{
|
||||
// Day
|
||||
$retstring.='<select'.($disabled?' disabled="disabled"':'').' class="flat" name="'.$prefix.'day">';
|
||||
|
||||
@@ -878,28 +878,33 @@ class DoliDBMysql
|
||||
{
|
||||
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
|
||||
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
|
||||
$sql = "create table ".$table."(";
|
||||
$sql = "CREATE TABLE ".$table."(";
|
||||
$i=0;
|
||||
foreach($fields as $field_name => $field_desc)
|
||||
{
|
||||
$sqlfields[$i] = $field_name." ";
|
||||
$sqlfields[$i] .= $field_desc['type'];
|
||||
if( preg_match("/^[^\s]/i",$field_desc['value']))
|
||||
$sqlfields[$i] .= "(".$field_desc['value'].")";
|
||||
else if( preg_match("/^[^\s]/i",$field_desc['attribute']))
|
||||
$sqlfields[$i] .= " ".$field_desc['attribute'];
|
||||
else if( preg_match("/^[^\s]/i",$field_desc['default']))
|
||||
{
|
||||
if(preg_match("/null/i",$field_desc['default']))
|
||||
$sqlfields[$i] .= " default ".$field_desc['default'];
|
||||
else
|
||||
$sqlfields[$i] .= " default '".$field_desc['default']."'";
|
||||
if( preg_match("/^[^\s]/i",$field_desc['value'])) {
|
||||
$sqlfields[$i] .= "(".$field_desc['value'].")";
|
||||
}
|
||||
if( preg_match("/^[^\s]/i",$field_desc['attribute'])) {
|
||||
$sqlfields[$i] .= " ".$field_desc['attribute'];
|
||||
}
|
||||
if( preg_match("/^[^\s]/i",$field_desc['default']))
|
||||
{
|
||||
if ((preg_match("/null/i",$field_desc['default'])) || (preg_match("/CURRENT_TIMESTAMP/i",$field_desc['default']))) {
|
||||
$sqlfields[$i] .= " default ".$field_desc['default'];
|
||||
}
|
||||
else {
|
||||
$sqlfields[$i] .= " default '".$field_desc['default']."'";
|
||||
}
|
||||
}
|
||||
if( preg_match("/^[^\s]/i",$field_desc['null'])) {
|
||||
$sqlfields[$i] .= " ".$field_desc['null'];
|
||||
}
|
||||
if( preg_match("/^[^\s]/i",$field_desc['extra'])) {
|
||||
$sqlfields[$i] .= " ".$field_desc['extra'];
|
||||
}
|
||||
else if( preg_match("/^[^\s]/i",$field_desc['null']))
|
||||
$sqlfields[$i] .= " ".$field_desc['null'];
|
||||
|
||||
else if( preg_match("/^[^\s]/i",$field_desc['extra']))
|
||||
$sqlfields[$i] .= " ".$field_desc['extra'];
|
||||
$i++;
|
||||
}
|
||||
if($primary_key != "")
|
||||
|
||||
@@ -872,28 +872,33 @@ class DoliDBMysqli
|
||||
{
|
||||
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
|
||||
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
|
||||
$sql = "create table ".$table."(";
|
||||
$sql = "CREATE TABLE ".$table."(";
|
||||
$i=0;
|
||||
foreach($fields as $field_name => $field_desc)
|
||||
{
|
||||
$sqlfields[$i] = $field_name." ";
|
||||
$sqlfields[$i] .= $field_desc['type'];
|
||||
if( preg_match("/^[^\s]/i",$field_desc['value']))
|
||||
$sqlfields[$i] .= "(".$field_desc['value'].")";
|
||||
else if( preg_match("/^[^\s]/i",$field_desc['attribute']))
|
||||
$sqlfields[$i] .= " ".$field_desc['attribute'];
|
||||
else if( preg_match("/^[^\s]/i",$field_desc['default']))
|
||||
{
|
||||
if(preg_match("/null/i",$field_desc['default']))
|
||||
$sqlfields[$i] .= " default ".$field_desc['default'];
|
||||
else
|
||||
$sqlfields[$i] .= " default '".$field_desc['default']."'";
|
||||
}
|
||||
else if( preg_match("/^[^\s]/i",$field_desc['null']))
|
||||
$sqlfields[$i] .= " ".$field_desc['null'];
|
||||
|
||||
else if( preg_match("/^[^\s]/i",$field_desc['extra']))
|
||||
$sqlfields[$i] .= " ".$field_desc['extra'];
|
||||
$sqlfields[$i] = $field_name." ";
|
||||
$sqlfields[$i] .= $field_desc['type'];
|
||||
if( preg_match("/^[^\s]/i",$field_desc['value'])) {
|
||||
$sqlfields[$i] .= "(".$field_desc['value'].")";
|
||||
}
|
||||
if( preg_match("/^[^\s]/i",$field_desc['attribute'])) {
|
||||
$sqlfields[$i] .= " ".$field_desc['attribute'];
|
||||
}
|
||||
if( preg_match("/^[^\s]/i",$field_desc['default']))
|
||||
{
|
||||
if ((preg_match("/null/i",$field_desc['default'])) || (preg_match("/CURRENT_TIMESTAMP/i",$field_desc['default']))) {
|
||||
$sqlfields[$i] .= " default ".$field_desc['default'];
|
||||
}
|
||||
else {
|
||||
$sqlfields[$i] .= " default '".$field_desc['default']."'";
|
||||
}
|
||||
}
|
||||
if( preg_match("/^[^\s]/i",$field_desc['null'])) {
|
||||
$sqlfields[$i] .= " ".$field_desc['null'];
|
||||
}
|
||||
if( preg_match("/^[^\s]/i",$field_desc['extra'])) {
|
||||
$sqlfields[$i] .= " ".$field_desc['extra'];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if($primary_key != "")
|
||||
@@ -938,7 +943,7 @@ class DoliDBMysqli
|
||||
*
|
||||
* @param string $table Name of table
|
||||
* @param string $field Optionnel : Name of field if we want description of field
|
||||
* @return resource Resource
|
||||
* @return resultset Resultset x (x->Field, x->Type, ...)
|
||||
*/
|
||||
function DDLDescTable($table,$field="")
|
||||
{
|
||||
|
||||
@@ -1169,7 +1169,7 @@ class DoliDBPgsql
|
||||
*
|
||||
* @param string $table Name of table
|
||||
* @param string $field Optionnel : Name of field if we want description of field
|
||||
* @return resource Resource
|
||||
* @return resultset Resultset x (x->attname)
|
||||
*/
|
||||
function DDLDescTable($table,$field="")
|
||||
{
|
||||
|
||||
@@ -186,9 +186,9 @@ function show_array_actions_to_do($max=5)
|
||||
$sql.= " s.nom as sname, s.rowid, s.client";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= ")";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
$sql.= " WHERE c.id = a.fk_action";
|
||||
$sql.= " AND a.entity = ".$conf->entity;
|
||||
$sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
|
||||
@@ -285,9 +285,9 @@ function show_array_last_actions_done($max=5)
|
||||
$sql.= " s.rowid, s.nom as sname, s.client";
|
||||
$sql.= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.=")";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
|
||||
$sql.= " WHERE c.id = a.fk_action";
|
||||
$sql.= " AND a.entity = ".$conf->entity;
|
||||
$sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
|
||||
|
||||
@@ -74,11 +74,11 @@ function barcode_print($code, $encoding="ANY", $scale = 2 ,$mode = "png")
|
||||
dol_syslog("barcode.lib.php::barcode_print $code $encoding $scale $mode");
|
||||
|
||||
$bars=barcode_encode($code,$encoding);
|
||||
|
||||
if (! $bars)
|
||||
if (! $bars || ! empty($bars['error']))
|
||||
{
|
||||
// DOLCHANGE LDR Return error message instead of array
|
||||
$error='Bad Value '.$code.' for encoding '.$encoding;
|
||||
if (empty($bars['error'])) $error='Bad Value '.$code.' for encoding '.$encoding;
|
||||
else $error=$bars['error'];
|
||||
dol_syslog('barcode.lib.php::barcode_print '.$error, LOG_ERR);
|
||||
return $error;
|
||||
}
|
||||
@@ -133,7 +133,7 @@ function barcode_encode($code,$encoding)
|
||||
dol_syslog("barcode.lib.php::barcode_encode Use barcode_encode_ean");
|
||||
$bars=barcode_encode_ean($code, $encoding);
|
||||
}
|
||||
else if (file_exists($genbarcode_loc))
|
||||
else if (file_exists($genbarcode_loc)) // For example C39
|
||||
{
|
||||
/* use genbarcode */
|
||||
dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding);
|
||||
@@ -252,10 +252,11 @@ function barcode_encode_genbarcode($code,$encoding)
|
||||
$code=preg_replace("/[\\\|]/", "_", $code);
|
||||
|
||||
$command=escapeshellarg($genbarcode_loc);
|
||||
$paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\"";
|
||||
|
||||
//$paramclear=" \"".str_replace("\"", "\\\"",$code)."\" \"".str_replace("\"", "\\\"",strtoupper($encoding))."\"";
|
||||
$paramclear=" ".escapeshellarg($code)." ".escapeshellarg(strtoupper($encoding));
|
||||
|
||||
$fullcommandclear=$command." ".$paramclear." 2>&1";
|
||||
//print $fullcommandclear."<br>\n";
|
||||
//print $fullcommandclear."<br>\n";exit;
|
||||
|
||||
dol_syslog("Run command ".$fullcommandclear);
|
||||
$fp=popen($fullcommandclear, "r");
|
||||
@@ -273,14 +274,20 @@ function barcode_encode_genbarcode($code,$encoding)
|
||||
}
|
||||
//var_dump($bars);
|
||||
$ret=array(
|
||||
"encoding" => trim($encoding),
|
||||
"bars" => trim($bars),
|
||||
"text" => trim($text)
|
||||
"text" => trim($text),
|
||||
"encoding" => trim($encoding),
|
||||
"error" => ""
|
||||
);
|
||||
//var_dump($ret);
|
||||
if (!$ret['encoding']) return false;
|
||||
if (preg_match('/permission denied/i',$ret['bars']))
|
||||
{
|
||||
$ret['error']=$ret['bars']; $ret['bars']='';
|
||||
return $ret;
|
||||
}
|
||||
if (!$ret['bars']) return false;
|
||||
if (!$ret['text']) return false;
|
||||
if (!$ret['encoding']) return false;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 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
|
||||
@@ -42,7 +42,7 @@ function dol_basename($pathfile)
|
||||
* @param string $path Starting path from which to search
|
||||
* @param string $types Can be "directories", "files", or "all"
|
||||
* @param int $recursive Determines whether subdirectories are searched
|
||||
* @param string $filter Regex for include filter
|
||||
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
|
||||
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.'))
|
||||
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
|
||||
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||
@@ -663,11 +663,11 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
}
|
||||
$hookmanager->initHooks(array('fileslib'));
|
||||
|
||||
$parameters=array('filename' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite);
|
||||
$reshook=$hookmanager->executeHooks('moveUploadedFile', $parameters, $object);
|
||||
$parameters=array('dest_file' => $dest_file, 'src_file' => $src_file, 'file_name' => $file_name, 'varfiles' => $varfiles, 'allowoverwrite' => $allowoverwrite);
|
||||
$hookmanager->executeHooks('moveUploadedFile', $parameters, $object);
|
||||
}
|
||||
|
||||
if (empty($reshook))
|
||||
if (empty($hookmanager->resPrint))
|
||||
{
|
||||
// The file functions must be in OS filesystem encoding.
|
||||
$src_file_osencoded=dol_osencode($src_file);
|
||||
@@ -700,6 +700,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
|
||||
return -3; // Unknown error
|
||||
}
|
||||
}
|
||||
else
|
||||
return $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -749,12 +751,14 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
|
||||
{
|
||||
$error=0;
|
||||
|
||||
//print "x".$file." ".$disableglob;
|
||||
//print "x".$file." ".$disableglob;exit;
|
||||
$ok=true;
|
||||
$file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset
|
||||
if (empty($disableglob) && ! empty($file_osencoded))
|
||||
{
|
||||
foreach (glob($file_osencoded) as $filename)
|
||||
$globencoded=str_replace('[','\[',$file_osencoded);
|
||||
$globencoded=str_replace(']','\]',$globencoded);
|
||||
foreach (glob($globencoded) as $filename)
|
||||
{
|
||||
if ($nophperrors) $ok=@unlink($filename); // The unlink encapsulated by dolibarr
|
||||
else $ok=unlink($filename); // The unlink encapsulated by dolibarr
|
||||
@@ -1237,8 +1241,8 @@ function dol_uncompress($inputfile,$outputdir)
|
||||
* Return most recent file
|
||||
*
|
||||
* @param string $dir Directory to scan
|
||||
* @param string $regexfilter Regexfilter
|
||||
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.'))
|
||||
* @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
|
||||
* @param string $excludefilter Array of Regex for exclude filter (example: array('\.meta$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function
|
||||
* @return strnig Full path to most recent file
|
||||
*/
|
||||
function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$','^\.'))
|
||||
|
||||
@@ -2100,10 +2100,10 @@ function dol_print_error($db='',$error='')
|
||||
$out.="<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
|
||||
//phpinfo(); // This is to show location of php.ini file
|
||||
}
|
||||
$out.="<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";;
|
||||
$out.="<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
|
||||
$out.="<br>\n";
|
||||
$out.="<b>".$langs->trans("RequestedUrl").":</b> ".$_SERVER["REQUEST_URI"]."<br>\n";;
|
||||
$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?$_SERVER["HTTP_REFERER"]:'')."<br>\n";;
|
||||
$out.="<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"],ENT_COMPAT,'UTF-8')."<br>\n";
|
||||
$out.="<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"])?dol_htmlentities($_SERVER["HTTP_REFERER"],ENT_COMPAT,'UTF-8'):'')."<br>\n";
|
||||
$out.="<b>".$langs->trans("MenuManager").":</b> ".$conf->top_menu."<br>\n";
|
||||
$out.="<br>\n";
|
||||
$syslog.="url=".$_SERVER["REQUEST_URI"];
|
||||
@@ -2689,7 +2689,18 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
|
||||
// Some test to guess with no need to make database access
|
||||
if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe
|
||||
{
|
||||
if ($local == 1 && ! $thirdparty_buyer->localtax1_assuj) return 0;
|
||||
if ($local == 1)
|
||||
{
|
||||
if ($thirdparty_seller->id==$mysoc->id)
|
||||
{
|
||||
if (! $thirdparty_buyer->localtax1_assuj) return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! $thirdparty_seller->localtax1_assuj) return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($local == 2 && ! $thirdparty_buyer->localtax2_assuj) return 0;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -506,7 +506,7 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next value for a mask
|
||||
* Return last or next value for a mask (according to area we should not reset)
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $mask Mask to use
|
||||
@@ -688,7 +688,6 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$posnumstart=strpos($maskwithnocode,$maskcounter); // Pos of counter in final string (from 0 to ...)
|
||||
if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
|
||||
$sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.dol_strlen($maskcounter).')';
|
||||
//print "x".$sqlstring;
|
||||
|
||||
// Define $maskLike
|
||||
$maskLike = dol_string_nospecial($mask);
|
||||
@@ -701,7 +700,6 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$maskLike = preg_replace('/\{dd\}/i','__',$maskLike);
|
||||
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
|
||||
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
||||
//if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",dol_strlen($masktype),"_"),$maskLike);
|
||||
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
||||
|
||||
// Get counter in database
|
||||
@@ -715,7 +713,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||
|
||||
//print $sql.'<br>';
|
||||
dol_syslog("functions2::get_next_value sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog("functions2::get_next_value mode=".$mode." sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@@ -725,30 +723,32 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
else dol_print_error($db);
|
||||
if (empty($counter) || preg_match('/[^0-9]/i',$counter)) $counter=$maskoffset;
|
||||
|
||||
if ($mode == 'last')
|
||||
if ($mode == 'last') // We found value for counter = last counter value. Now need to get corresponding ref of invoice.
|
||||
{
|
||||
$counterpadded=str_pad($counter,dol_strlen($maskcounter),"0",STR_PAD_LEFT);
|
||||
|
||||
// Define $maskLike
|
||||
$maskLike = dol_string_nospecial($mask);
|
||||
$maskLike = str_replace("%","_",$maskLike);
|
||||
// Replace protected special codes with matching number of _ as wild card caracter
|
||||
$maskLike = preg_replace('/\{yyyy\}/i','____',$maskLike);
|
||||
$maskLike = preg_replace('/\{yy\}/i','__',$maskLike);
|
||||
$maskLike = preg_replace('/\{y\}/i','_',$maskLike);
|
||||
$maskLike = preg_replace('/\{mm\}/i','__',$maskLike);
|
||||
$maskLike = preg_replace('/\{dd\}/i','__',$maskLike);
|
||||
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),$counterpadded,$maskLike);
|
||||
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
||||
//if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",dol_strlen($masktype),"_"),$maskLike);
|
||||
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
||||
|
||||
// Define $maskLike
|
||||
$maskLike = dol_string_nospecial($mask);
|
||||
$maskLike = str_replace("%","_",$maskLike);
|
||||
// Replace protected special codes with matching number of _ as wild card caracter
|
||||
$maskLike = preg_replace('/\{yyyy\}/i','____',$maskLike);
|
||||
$maskLike = preg_replace('/\{yy\}/i','__',$maskLike);
|
||||
$maskLike = preg_replace('/\{y\}/i','_',$maskLike);
|
||||
$maskLike = preg_replace('/\{mm\}/i','__',$maskLike);
|
||||
$maskLike = preg_replace('/\{dd\}/i','__',$maskLike);
|
||||
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),$counterpadded,$maskLike);
|
||||
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
|
||||
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
|
||||
|
||||
$ref='';
|
||||
$sql = "SELECT facnumber as ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.= " WHERE facnumber LIKE '".$maskLike."'";
|
||||
$sql = "SELECT ".$field." as ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$table;
|
||||
$sql.= " WHERE ".$field." LIKE '".$maskLike."'";
|
||||
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
|
||||
$sql.= " AND entity IN (".getEntity($table, 1).")";
|
||||
|
||||
if ($where) $sql.=$where;
|
||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||
|
||||
dol_syslog("functions2::get_next_value sql=".$sql);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@@ -72,7 +72,10 @@ function dol_json_encode($elements)
|
||||
$output = '{';
|
||||
$last = $num - 1;
|
||||
$i = 0;
|
||||
foreach($elements as $key => $value)
|
||||
$tmpelements=array();
|
||||
if (is_array($elements)) $tmpelements=$elements;
|
||||
if (is_object($elements)) $tmpelements=get_object_vars($elements);
|
||||
foreach($tmpelements as $key => $value)
|
||||
{
|
||||
$output .= '"'.$key.'":';
|
||||
if (is_array($value)) $output.= json_encode($value);
|
||||
|
||||
@@ -112,11 +112,15 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
if (method_exists($objcanvas->control,'restrictedArea')) return $objcanvas->control->restrictedArea($user,$features,$objectid,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
|
||||
}
|
||||
|
||||
if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
|
||||
if ($dbt_select != 'rowid' && $dbt_select != 'id') $objectid = "'".$objectid."'";
|
||||
|
||||
// More features to check
|
||||
$features = explode("&", $features);
|
||||
|
||||
// More subfeatures to check
|
||||
if (!empty($feature2))
|
||||
$feature2 = explode("&", $feature2);
|
||||
|
||||
// More parameters
|
||||
$params = explode('&', $dbtablename);
|
||||
$dbtablename=(! empty($params[0]) ? $params[0] : '');
|
||||
@@ -164,8 +168,11 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
}
|
||||
else if (! empty($feature2)) // This should be used for future changes
|
||||
{
|
||||
if (empty($user->rights->$feature->$feature2->lire)
|
||||
&& empty($user->rights->$feature->$feature2->read)) $readok=0;
|
||||
foreach($feature2 as $subfeature)
|
||||
{
|
||||
if (empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) $readok=0;
|
||||
else { $readok=1; break; } // For bypass the second test if the first is ok
|
||||
}
|
||||
}
|
||||
else if (! empty($feature) && ($feature!='user' && $feature!='usergroup')) // This is for old permissions
|
||||
{
|
||||
@@ -210,8 +217,13 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
}
|
||||
else if (! empty($feature2)) // This should be used for future changes
|
||||
{
|
||||
if (empty($user->rights->$feature->$feature2->creer)
|
||||
&& empty($user->rights->$feature->$feature2->write)) $createok=0;
|
||||
foreach($feature2 as $subfeature)
|
||||
{
|
||||
if (empty($user->rights->$feature->$subfeature->creer)
|
||||
&& empty($user->rights->$feature->$subfeature->write)
|
||||
&& empty($user->rights->$feature->$subfeature->create)) $createok=0;
|
||||
else { $createok=1; break; } // For bypass the second test if the first is ok
|
||||
}
|
||||
}
|
||||
else if (! empty($feature)) // This is for old permissions
|
||||
{
|
||||
@@ -271,8 +283,11 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
|
||||
}
|
||||
else if (! empty($feature2)) // This should be used for future changes
|
||||
{
|
||||
if (empty($user->rights->$feature->$feature2->supprimer)
|
||||
&& empty($user->rights->$feature->$feature2->delete)) $deleteok=0;
|
||||
foreach($feature2 as $subfeature)
|
||||
{
|
||||
if (empty($user->rights->$feature->$subfeature->supprimer) && empty($user->rights->$feature->$subfeature->delete)) $deleteok=0;
|
||||
else { $deleteok=1; break; } // For bypass the second test if the first is ok
|
||||
}
|
||||
}
|
||||
else if (! empty($feature)) // This is for old permissions
|
||||
{
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
README (english)
|
||||
---------------------------------------------
|
||||
Decription of htdocs/core/login directory
|
||||
---------------------------------------------
|
||||
|
||||
This directory contains files that handle way to validate passwords.
|
||||
|
||||
If you want to add a new password checker function, just add a file in
|
||||
this directory that follow example of already existing files.
|
||||
This file must be called for example :
|
||||
functions_mypasschecker.php
|
||||
|
||||
Edit function name to call it:
|
||||
check_user_mypasschecker
|
||||
|
||||
Change code of this function to return true if couple
|
||||
$usertotest / $passwordtotest is ok for you.
|
||||
|
||||
Then, you must edit you conf.php file to change the value of
|
||||
$dolibarr_main_authentication
|
||||
parameter to set it to :
|
||||
mypasschecker
|
||||
|
||||
Once this is done, when you log in to Dolibarr, the function
|
||||
check_user_mypasschecker in this file is called.
|
||||
If the function return true and login exists, login is accepted.
|
||||
README (english)
|
||||
---------------------------------------------
|
||||
Decription of htdocs/core/login directory
|
||||
---------------------------------------------
|
||||
|
||||
This directory contains files that handle way to validate passwords.
|
||||
|
||||
If you want to add a new password checker function, just add a file in
|
||||
this directory that follow example of already existing files.
|
||||
This file must be called for example :
|
||||
functions_mypasschecker.php
|
||||
|
||||
Edit function name to call it:
|
||||
check_user_mypasschecker
|
||||
|
||||
Change code of this function to return true if couple
|
||||
$usertotest / $passwordtotest is ok for you.
|
||||
|
||||
Then, you must edit you conf.php file to change the value of
|
||||
$dolibarr_main_authentication
|
||||
parameter to set it to :
|
||||
mypasschecker
|
||||
|
||||
Once this is done, when you log in to Dolibarr, the function
|
||||
check_user_mypasschecker in this file is called.
|
||||
If the function return true and login exists, login is accepted.
|
||||
|
||||
@@ -48,7 +48,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
|
||||
// Home
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "home")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -76,7 +76,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
$langs->load("suppliers");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "companies")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -110,14 +110,14 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
}
|
||||
|
||||
// Products-Services
|
||||
$tmpentry=array('enabled'=>($conf->product->enabled || $conf->service->enabled), 'perms'=>($user->rights->produit->lire || $user->rights->service->lire), 'module'=>'product|service');
|
||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
{
|
||||
$tmpentry=array('enabled'=>($conf->product->enabled || $conf->service->enabled), 'perms'=>($user->rights->produit->lire || $user->rights->service->lire), 'module'=>'product|service');
|
||||
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
|
||||
if ($showmode)
|
||||
{
|
||||
$langs->load("products");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "products")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -167,7 +167,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
$langs->load("commercial");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "commercial")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -209,7 +209,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
$langs->load("compta");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "accountancy")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -252,7 +252,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
$langs->load("banks");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "bank")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -294,7 +294,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
$langs->load("projects");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "project")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -336,7 +336,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
$langs->load("other");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "tools")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -378,7 +378,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
$langs->load("shop");
|
||||
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "shop")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "shop")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -406,7 +406,7 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
if ($showmode)
|
||||
{
|
||||
$classname="";
|
||||
if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members")
|
||||
if (isset($_SESSION["mainmenu"]) && $_SESSION["mainmenu"] == "members")
|
||||
{
|
||||
$classname='class="tmenusel"'; $_SESSION['idmenu']='';
|
||||
}
|
||||
@@ -451,10 +451,10 @@ function print_eldy_menu($db,$atarget,$type_user)
|
||||
{
|
||||
$idsel=(empty($newTabMenu[$i]['mainmenu'])?'none':$newTabMenu[$i]['mainmenu']);
|
||||
|
||||
$showmode=dol_eldy_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
||||
$showmode=dol_eldy_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
||||
|
||||
if ($showmode == 1)
|
||||
{
|
||||
if ($showmode == 1)
|
||||
{
|
||||
if (preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
|
||||
{
|
||||
$url = $newTabMenu[$i]['url'];
|
||||
@@ -1462,36 +1462,36 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to test if an entry is enabled or not
|
||||
*
|
||||
* @param string $type_user 0=We need backoffice menu, 1=We need frontoffice menu
|
||||
* @param array &$menuentry Array for menu entry
|
||||
* @param array &$listofmodulesforexternal Array with list of modules allowed to external users
|
||||
* @return int 0=Hide, 1=Show, 2=Show gray
|
||||
*/
|
||||
function dol_eldy_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
|
||||
{
|
||||
//print 'type_user='.$type_user.' module='.$menuentry['module'].' enabled='.$menuentry['enabled'].' perms='.$menuentry['perms'];
|
||||
//print 'ok='.in_array($menuentry['module'], $listofmodulesforexternal);
|
||||
|
||||
if (empty($menuentry['enabled'])) return 0; // Entry disabled by condition
|
||||
if ($type_user && $menuentry['module'])
|
||||
{
|
||||
$tmploops=explode('|',$menuentry['module']);
|
||||
$found=0;
|
||||
foreach($tmploops as $tmploop)
|
||||
{
|
||||
if (in_array($tmploop, $listofmodulesforexternal)) {
|
||||
$found++; break;
|
||||
}
|
||||
}
|
||||
if (! $found) return 0; // Entry is for menus all excluded to external users
|
||||
}
|
||||
if (! $menuentry['perms'] && $type_user) return 0; // No permissions and user is external
|
||||
if (! $menuentry['perms'] && ! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) return 0; // No permissions and option to hide when not allowed, even for internal user, is on
|
||||
if (! $menuentry['perms']) return 2; // No permissions and user is external
|
||||
return 1;
|
||||
/**
|
||||
* Function to test if an entry is enabled or not
|
||||
*
|
||||
* @param string $type_user 0=We need backoffice menu, 1=We need frontoffice menu
|
||||
* @param array &$menuentry Array for menu entry
|
||||
* @param array &$listofmodulesforexternal Array with list of modules allowed to external users
|
||||
* @return int 0=Hide, 1=Show, 2=Show gray
|
||||
*/
|
||||
function dol_eldy_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
|
||||
{
|
||||
//print 'type_user='.$type_user.' module='.$menuentry['module'].' enabled='.$menuentry['enabled'].' perms='.$menuentry['perms'];
|
||||
//print 'ok='.in_array($menuentry['module'], $listofmodulesforexternal);
|
||||
|
||||
if (empty($menuentry['enabled'])) return 0; // Entry disabled by condition
|
||||
if ($type_user && $menuentry['module'])
|
||||
{
|
||||
$tmploops=explode('|',$menuentry['module']);
|
||||
$found=0;
|
||||
foreach($tmploops as $tmploop)
|
||||
{
|
||||
if (in_array($tmploop, $listofmodulesforexternal)) {
|
||||
$found++; break;
|
||||
}
|
||||
}
|
||||
if (! $found) return 0; // Entry is for menus all excluded to external users
|
||||
}
|
||||
if (! $menuentry['perms'] && $type_user) return 0; // No permissions and user is external
|
||||
if (! $menuentry['perms'] && ! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) return 0; // No permissions and option to hide when not allowed, even for internal user, is on
|
||||
if (! $menuentry['perms']) return 2; // No permissions and user is external
|
||||
return 1;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -906,7 +906,9 @@ abstract class DolibarrModules
|
||||
dol_syslog(get_class($this)."::insert_permissions Add permission to user id=".$obj2->rowid);
|
||||
$tmpuser=new User($this->db);
|
||||
$tmpuser->fetch($obj2->rowid);
|
||||
$tmpuser->addrights($r_id);
|
||||
if (!empty($tmpuser->id)) {
|
||||
$tmpuser->addrights($r_id);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if (! empty($user->admin)) // Reload permission for current user if defined
|
||||
|
||||
@@ -66,8 +66,7 @@ class ImportCsv extends ModeleImports
|
||||
global $conf,$langs;
|
||||
$this->db = $db;
|
||||
|
||||
$this->separator=','; // Change also function cleansep
|
||||
if (! empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE)) $this->separator=$conf->global->IMPORT_CSV_SEPARATOR_TO_USE;
|
||||
$this->separator=(GETPOST('separator')?GETPOST('separator'):(empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE)?',':$conf->global->IMPORT_CSV_SEPARATOR_TO_USE));
|
||||
$this->enclosure='"';
|
||||
$this->escape='"';
|
||||
|
||||
@@ -579,7 +578,7 @@ class ImportCsv extends ModeleImports
|
||||
//var_dump($objimport->array_import_convertvalue); exit;
|
||||
|
||||
// Build SQL request
|
||||
if (! tablewithentity($tablename))
|
||||
if (! tablewithentity($tablename))
|
||||
{
|
||||
$sql ='INSERT INTO '.$tablename.'('.$listfields.', import_key';
|
||||
if (! empty($objimport->array_import_tables_creator[0][$alias])) $sql.=', '.$objimport->array_import_tables_creator[0][$alias];
|
||||
@@ -651,25 +650,16 @@ function cleansep($value)
|
||||
function tablewithentity($table)
|
||||
{
|
||||
global $db;
|
||||
$sql = "SHOW COLUMNS FROM ".$table." LIKE 'entity'";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$numrows=$db->num_rows($resql);
|
||||
if ($numrows)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
|
||||
$resql=$db->DDLDescTable($table,'entity');
|
||||
if ($resql)
|
||||
{
|
||||
$i=0;
|
||||
$obj=$db->fetch_object($resql);
|
||||
if ($obj) return 1;
|
||||
else return 0;
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -38,6 +38,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
*/
|
||||
class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
{
|
||||
var $db;
|
||||
var $name;
|
||||
var $description;
|
||||
var $type;
|
||||
|
||||
var $phpmin = array(4,3,0); // Minimum version of PHP required by module
|
||||
var $version = 'dolibarr';
|
||||
|
||||
var $page_largeur;
|
||||
var $page_hauteur;
|
||||
var $format;
|
||||
var $marge_gauche;
|
||||
var $marge_droite;
|
||||
var $marge_haute;
|
||||
var $marge_basse;
|
||||
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
/**
|
||||
@@ -75,26 +91,26 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
$this->franchise=!$mysoc->tva_assuj;
|
||||
|
||||
// Recupere emmetteur
|
||||
// Get source company
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||
if (empty($this->emetteur->country_code)) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default, if was not defined
|
||||
|
||||
// Defini position des colonnes
|
||||
// Define position of columns
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
$this->posxcomm=120;
|
||||
$this->posxcomm=111;
|
||||
//$this->posxtva=111;
|
||||
$this->posxup=132;
|
||||
$this->posxqty=168;
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=177;
|
||||
//$this->posxup=126;
|
||||
$this->posxqty=174;
|
||||
//$this->posxdiscount=162;
|
||||
//$this->postotalht=174;
|
||||
if ($this->page_largeur < 210) // To work with US executive format
|
||||
{
|
||||
$this->posxcomm-=20;
|
||||
//$this->posxtva-=20;
|
||||
$this->posxup-=20;
|
||||
//$this->posxup-=20;
|
||||
$this->posxqty-=20;
|
||||
$this->posxdiscount-=20;
|
||||
$this->postotalht-=20;
|
||||
//$this->posxdiscount-=20;
|
||||
//$this->postotalht-=20;
|
||||
}
|
||||
|
||||
$this->tva=array();
|
||||
@@ -104,15 +120,19 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
|
||||
/**
|
||||
* Fonction generant le bon de livraison sur le disque
|
||||
*
|
||||
* @param Object $object Object livraison a generer
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @return int 1 if OK, <=0 if KO
|
||||
* Function to build pdf onto disk
|
||||
*
|
||||
* @param Object $object Object to generate
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
* @param int $hidedesc Do not show desc
|
||||
* @param int $hideref Do not show ref
|
||||
* @return int 1=OK, 0=KO
|
||||
*/
|
||||
function write_file($object,$outputlangs)
|
||||
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
global $user,$langs,$conf,$mysoc,$hookmanager;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
@@ -126,17 +146,23 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$outputlangs->load("deliveries");
|
||||
$outputlangs->load("sendings");
|
||||
|
||||
if ($conf->expedition->dir_output."/receipt")
|
||||
if ($conf->expedition->dir_output)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$nblines = count($object->lines);
|
||||
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->expedition->dir_output."/receipt";
|
||||
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".pdf";
|
||||
|
||||
// Definition of $dir and $file
|
||||
if ($object->specimen)
|
||||
{
|
||||
$dir = $conf->expedition->dir_output."/receipt";
|
||||
$file = $dir . "/SPECIMEN.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir = $conf->expedition->dir_output."/receipt/" . $objectref;
|
||||
$file = $dir . "/" . $objectref . ".pdf";
|
||||
}
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (dol_mkdir($dir) < 0)
|
||||
@@ -148,9 +174,12 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
$pdf=pdf_getInstance($this->format);
|
||||
$nblines = count($object->lines);
|
||||
|
||||
// Create pdf instance
|
||||
$pdf=pdf_getInstance($this->format);
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
|
||||
$heightforinfotot = 50; // Height reserved to output the info and total part
|
||||
$heightforinfotot = 30; // Height reserved to output the info and total part
|
||||
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
|
||||
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
@@ -195,7 +224,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
/*
|
||||
// Positionne $this->atleastonediscount si on a au moins une remise
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
for ($i = 0 ; $i < $nblines ; $i++)
|
||||
{
|
||||
if ($object->lines[$i]->remise_percent)
|
||||
{
|
||||
@@ -214,7 +243,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$tab_top = 90;
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?22:10);
|
||||
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10);
|
||||
$tab_height = 130;
|
||||
$tab_height_newpage = 150;
|
||||
|
||||
@@ -223,7 +252,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
{
|
||||
$tab_top = 88;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($object->note_public), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_note=$nexY-$tab_top;
|
||||
@@ -252,13 +281,46 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$pdf->setTopMargin($tab_top_newpage);
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext); // The only function to edit the bottom margin of current page to set it.
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
|
||||
$pageposbefore=$pdf->getPage();
|
||||
|
||||
// Description of product line
|
||||
$curX = $this->posxdesc-1;
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$curX,$curY);
|
||||
|
||||
$showpricebeforepagebreak=1;
|
||||
|
||||
$pdf->startTransaction();
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,3,$curX,$curY,$hideref,$hidedesc);
|
||||
$pageposafter=$pdf->getPage();
|
||||
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
||||
{
|
||||
$pdf->rollbackTransaction(true);
|
||||
$pageposafter=$pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxcomm-$curX,4,$curX,$curY,$hideref,$hidedesc);
|
||||
$posyafter=$pdf->GetY();
|
||||
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
|
||||
{
|
||||
if ($i == ($nblines-1)) // No more lines, and no space left to show total, so we create a new page
|
||||
{
|
||||
$pdf->AddPage('','',true);
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
$pdf->setPage($pagenb+1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We found a page break
|
||||
$showpricebeforepagebreak=0;
|
||||
}
|
||||
}
|
||||
else // No pagebreak
|
||||
{
|
||||
$pdf->commitTransaction();
|
||||
}
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
$pageposafter=$pdf->getPage();
|
||||
$pdf->setPage($pageposbefore);
|
||||
@@ -266,17 +328,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
|
||||
// We suppose that a too long description is moved completely on next page
|
||||
if ($pageposafter > $pageposbefore) {
|
||||
if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) {
|
||||
$pdf->setPage($pageposafter); $curY = $tab_top_newpage;
|
||||
}
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
||||
|
||||
$nexY = $pdf->GetY()+4;
|
||||
|
||||
/*
|
||||
// TVA
|
||||
$pdf->SetXY($this->posxtva, $curY);
|
||||
$pdf->SetXY($this->posxcomm, $curY);
|
||||
$pdf->MultiCell(10, 4, ($object->lines[$i]->tva_tx < 0 ? '*':'').abs($object->lines[$i]->tva_tx), 0, 'R');
|
||||
|
||||
// Prix unitaire HT avant remise
|
||||
@@ -284,8 +344,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->MultiCell(20, 4, price($object->lines[$i]->subprice), 0, 'R', 0);
|
||||
*/
|
||||
// Quantity
|
||||
//$qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetXY($this->posxqty, $curY);
|
||||
$pdf->MultiCell(30, 3, $object->lines[$i]->qty_shipped, 0, 'R');
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 3, $object->lines[$i]->qty_shipped, 0, 'R');
|
||||
/*
|
||||
// Remise sur ligne
|
||||
$pdf->SetXY($this->posxdiscount, $curY);
|
||||
@@ -307,7 +368,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
*/
|
||||
|
||||
// Add line
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1))
|
||||
if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
|
||||
{
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(210,210,210)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
@@ -333,6 +394,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pagenb++;
|
||||
$pdf->setPage($pagenb);
|
||||
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak)
|
||||
{
|
||||
@@ -349,34 +411,38 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->AddPage();
|
||||
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
|
||||
$pagenb++;
|
||||
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
|
||||
}
|
||||
}
|
||||
|
||||
// Show square
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
|
||||
$this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfooter + 1;
|
||||
$this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0);
|
||||
$bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pied de page
|
||||
*/
|
||||
// Affiche zone infos
|
||||
$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs);
|
||||
|
||||
// Pied de page
|
||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
||||
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
// Check product remaining to be delivered
|
||||
// TODO doit etre modifie
|
||||
//$waitingDelivery = $object->getRemainingDelivered();
|
||||
/*
|
||||
$waitingDelivery='';
|
||||
|
||||
if (is_array($waitingDelivery) & !empty($waitingDelivery))
|
||||
{
|
||||
$pdf->AddPage('P', 'A4');
|
||||
$pdf->AddPage();
|
||||
|
||||
$this->_pagehead($pdf, $object, 1, $outputlangs);
|
||||
$pdf-> SetY(90);
|
||||
@@ -426,17 +492,28 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
$this->_pagefoot($pdf,$object,$outputlangs);
|
||||
|
||||
}
|
||||
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AliasNbPages();
|
||||
}*/
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
return 1;
|
||||
// Add pdfgeneration hook
|
||||
if (! is_object($hookmanager))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||
$hookmanager=new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||
global $action;
|
||||
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
return 1; // pas d'erreur
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -449,66 +526,90 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show miscellaneous information (payment mode, payment term, ...)
|
||||
*
|
||||
* @param PDF &$pdf Object PDF
|
||||
* @param Object $object Object to show
|
||||
* @param int $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @return void
|
||||
*/
|
||||
function _tableau_info(&$pdf, $object, $posy, $outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size);
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
|
||||
$pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
|
||||
$pdf->SetXY($this->marge_gauche + 2, $posy + 2);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
|
||||
|
||||
$pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25);
|
||||
$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show table for lines
|
||||
*
|
||||
* @param PDF &$pdf Object PDF
|
||||
* @param string $tab_top Top position of table
|
||||
* @param string $tab_height Height of table (rectangle)
|
||||
* @param int $nexY Y
|
||||
* @param int $nexY Y (not used)
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @param int $hidetop Hide top bar of array
|
||||
* @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title
|
||||
* @param int $hidebottom Hide bottom bar of array
|
||||
* @return void
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
|
||||
{
|
||||
global $conf,$mysoc;
|
||||
|
||||
// Force to disable hidetop and hidebottom
|
||||
$hidebottom=0;
|
||||
if ($hidetop) $hidetop=-1;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
|
||||
// line prend une position y en 3eme param
|
||||
if (empty($hidetop))
|
||||
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
|
||||
|
||||
|
||||
// Amount in (at tab_top - 1)
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
|
||||
// Output Rec
|
||||
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param
|
||||
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->line($this->marge_gauche, $tab_top+6, $this->page_largeur-$this->marge_droite, $tab_top+6);
|
||||
}
|
||||
|
||||
$pdf->SetDrawColor(128,128,128);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
|
||||
if (empty($hidetop)) {
|
||||
if (empty($hidetop))
|
||||
{
|
||||
$pdf->SetXY($this->posxdesc-1, $tab_top+1);
|
||||
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L');
|
||||
$pdf->MultiCell($this->posxcomm - $this->posxdesc,2, $outputlangs->transnoentities("Designation"),'','L');
|
||||
}
|
||||
|
||||
// Modif SEB pour avoir une col en plus pour les commentaires clients
|
||||
$pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxcomm, $tab_top+1);
|
||||
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L');
|
||||
$pdf->MultiCell($this->posxqty - $this->posxcomm,2, $outputlangs->transnoentities("Comments"),'','L');
|
||||
}
|
||||
|
||||
// Qty
|
||||
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
|
||||
if (empty($hidetop)) {
|
||||
$pdf->SetXY($this->posxqty-1, $tab_top+1);
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R');
|
||||
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->posxqty, 2, $outputlangs->transnoentities("QtyShipped"),'','R');
|
||||
}
|
||||
|
||||
if (empty($hidebottom)) {
|
||||
// Modif Seb cadres signatures
|
||||
$pdf->SetFont('','', $default_font_size);
|
||||
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
|
||||
$pdf->Rect($this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25);
|
||||
$pdf->SetXY($this->marge_gauche + 2, $tab_top + $tab_height + 5);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":",'','L');
|
||||
|
||||
$pdf->Rect(2*$larg_sign+$this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25);
|
||||
$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $tab_top + $tab_height + 5);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -522,22 +623,29 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
*/
|
||||
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
|
||||
{
|
||||
global $langs,$conf,$mysoc;
|
||||
global $conf,$langs,$hookmanager;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('','B', $default_font_size + 3);
|
||||
|
||||
$posx=$this->page_largeur-$this->marge_droite-100;
|
||||
$posy=$this->marge_haute;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Show Draft Watermark
|
||||
if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) )
|
||||
{
|
||||
pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK);
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->SetFont('','B', $default_font_size + 3);
|
||||
|
||||
$posy=$this->marge_haute;
|
||||
$posx=$this->page_largeur-$this->marge_droite-100;
|
||||
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
|
||||
// Logo
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
|
||||
if ($mysoc->logo)
|
||||
$logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
@@ -548,8 +656,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
{
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
}
|
||||
else $pdf->MultiCell(100, 4, $this->emetteur->name, 0, 'L');
|
||||
@@ -557,7 +665,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetFont('','B', $default_font_size + 2);
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '', 'R');
|
||||
|
||||
$pdf->SetFont('','',$default_font_size + 2);
|
||||
|
||||
@@ -585,69 +693,42 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
|
||||
// Add origin linked objects
|
||||
// TODO extend to other objects
|
||||
$object->fetchObjectLinked('','',$object->id,'delivery');
|
||||
|
||||
if (! empty($object->linkedObjects))
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
|
||||
foreach($object->linkedObjects as $elementtype => $objects)
|
||||
{
|
||||
$object->fetchObjectLinked('','',$objects[0]->id,$objects[0]->element);
|
||||
|
||||
foreach($object->linkedObjects as $elementtype => $objects)
|
||||
{
|
||||
$num=count($objects);
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$order=new Commande($this->db);
|
||||
$result=$order->fetch($objects[$i]->id);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$posy+=5;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$text=$order->ref;
|
||||
if ($order->ref_client) $text.=' ('.$order->ref_client.')';
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$posy+=2;
|
||||
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
// Emetteur
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
$posx=$this->marge_gauche;
|
||||
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80;
|
||||
$hautcadre=40;
|
||||
|
||||
// Show sender frame
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->SetXY($this->marge_gauche,$posy-5);
|
||||
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":");
|
||||
|
||||
|
||||
$pdf->SetXY($this->marge_gauche,$posy);
|
||||
$pdf->SetXY($posx,$posy-5);
|
||||
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L');
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFillColor(230,230,230);
|
||||
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
|
||||
|
||||
|
||||
$pdf->SetXY($this->marge_gauche+2,$posy+3);
|
||||
|
||||
// Nom emetteur
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
|
||||
// Show sender name
|
||||
$pdf->SetXY($posx+2,$posy+3);
|
||||
$pdf->SetFont('','B',$default_font_size);
|
||||
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
|
||||
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->marge_gauche+2,$posy+9);
|
||||
$pdf->MultiCell(80, 3, $carac_emetteur, 0, 'L');
|
||||
|
||||
// Show sender information
|
||||
$pdf->SetXY($posx+2,$posy+8);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
|
||||
|
||||
// Client destinataire
|
||||
$posy=42;
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
@@ -655,7 +736,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$pdf->SetXY(102,$posy-5);
|
||||
$pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L');
|
||||
|
||||
// If SHIPPING contact defined on invoice, we use it
|
||||
// If SHIPPING contact defined on order, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->commande->getIdContact('external','SHIPPING');
|
||||
if (count($arrayidcontact) > 0)
|
||||
@@ -677,7 +758,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
|
||||
}
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target');
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
@@ -700,7 +781,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
// Show recipient information
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($posx+2,$posy+8);
|
||||
$pdf->SetXY($posx+2,$posy+4+(dol_nboflines_bis($carac_client_name,50)*4));
|
||||
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
|
||||
}
|
||||
|
||||
@@ -713,7 +794,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
* @param Object $object Object to show
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
* @return void
|
||||
* @return int Return height of bottom margin including footer text
|
||||
*/
|
||||
function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0)
|
||||
{
|
||||
|
||||
@@ -88,9 +88,10 @@ class mailing_contacts1 extends MailingTargets
|
||||
* For example if this selector is used to extract 500 different
|
||||
* emails from a text file, this function must return 500.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int
|
||||
*/
|
||||
function getNbOfRecipients()
|
||||
function getNbOfRecipients($sql='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
|
||||
/* Copyright (C) 2011 François Cerbelle <francois@cerbelle.net>
|
||||
* Copyright (C) 2013 Regis Houssin <regis.houssin@capnetworks.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
|
||||
@@ -80,14 +81,13 @@ class mailing_contacts2 extends MailingTargets
|
||||
$sql = "SELECT sp.rowid as id, sp.email as email, sp.rowid as fk_contact,";
|
||||
$sql.= " sp.name as name, sp.firstname as firstname, sp.civilite,";
|
||||
$sql.= " s.nom as companyname";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.poste != ''";
|
||||
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
||||
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$filtersarray[0]."'";
|
||||
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$this->db->escape($filtersarray[0])."'";
|
||||
$sql.= " ORDER BY sp.name, sp.firstname";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
@@ -151,9 +151,10 @@ class mailing_contacts2 extends MailingTargets
|
||||
/**
|
||||
* Return here number of distinct emails returned by your selector.
|
||||
*
|
||||
* @param string $sql Requete sql de comptage
|
||||
* @return int
|
||||
*/
|
||||
function getNbOfRecipients()
|
||||
function getNbOfRecipients($sql='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -161,10 +162,9 @@ class mailing_contacts2 extends MailingTargets
|
||||
// Number with a filter are show in the combo list for each filter.
|
||||
// If we want a filter "a position is defined", we must add it into formFilter
|
||||
$sql = "SELECT count(distinct(sp.email)) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
||||
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.poste != ''";
|
||||
@@ -186,10 +186,9 @@ class mailing_contacts2 extends MailingTargets
|
||||
$langs->load("companies");
|
||||
|
||||
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = sp.fk_soc";
|
||||
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
|
||||
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND sp.no_email = 0";
|
||||
$sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
|
||||
@@ -218,4 +217,4 @@ class mailing_contacts2 extends MailingTargets
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user