Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c639e82062 | ||
|
|
e6ab6bdb8e | ||
|
|
7a0206adce | ||
|
|
0ce7cad48c | ||
|
|
7673a73a65 | ||
|
|
8377d6967a | ||
|
|
0cab08b2f3 | ||
|
|
f0a3bca4c2 | ||
|
|
4a52d3c1b1 | ||
|
|
84a152dc2e | ||
|
|
01854b3259 | ||
|
|
3bbedf1795 | ||
|
|
87a102f5c8 | ||
|
|
600dbced7e | ||
|
|
8d829dca32 | ||
|
|
fe78996026 | ||
|
|
375e61de2e | ||
|
|
5777c16b72 | ||
|
|
fdf9617e42 | ||
|
|
d499fafdb9 | ||
|
|
60debe31c4 | ||
|
|
cbff03ca08 | ||
|
|
316b7453e4 | ||
|
|
80d2445540 | ||
|
|
ad82135879 | ||
|
|
75bcb7e53f | ||
|
|
f566b38296 | ||
|
|
fa088eb6cc | ||
|
|
b0cf9bd0be | ||
|
|
9b797c1831 | ||
|
|
e1ea2215a3 | ||
|
|
0543a31920 | ||
|
|
fb34f25701 | ||
|
|
69ac75bef8 | ||
|
|
384c89dcef | ||
|
|
e886c89e06 | ||
|
|
00f0aff6f0 | ||
|
|
f3ef9b868f |
@@ -1,13 +0,0 @@
|
||||
# Save as .codeclimate.yml (note leading .) in project root directory
|
||||
languages:
|
||||
Ruby: false
|
||||
JavaScript: true
|
||||
PHP: true
|
||||
engines:
|
||||
phpcodesniffer: true
|
||||
exclude_paths:
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'test/*'
|
||||
- 'htdocs/includes/*'
|
||||
@@ -1,16 +0,0 @@
|
||||
build
|
||||
build.xml
|
||||
ChangeLog
|
||||
composer.json
|
||||
CONTRIBUTING.md
|
||||
COPYING
|
||||
COPYRIGHT
|
||||
dev
|
||||
doc
|
||||
Dockerfile
|
||||
INSTALL
|
||||
README-FR.md
|
||||
README.md
|
||||
robots.txt
|
||||
scripts
|
||||
test
|
||||
@@ -1,17 +0,0 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
[*.php]
|
||||
indent_style = tab
|
||||
[*.js]
|
||||
indent_style = tab
|
||||
[*.css]
|
||||
indent_style = tab
|
||||
[*.xml]
|
||||
indent_style = tab
|
||||
1
.gitignore
vendored
@@ -9,7 +9,6 @@ default.properties
|
||||
.buildpath
|
||||
.gitmodules
|
||||
dolibarr_install.log
|
||||
upgrade.log
|
||||
doxygen_warnings.log
|
||||
/.project
|
||||
.DS_Store
|
||||
|
||||
91
.mailmap
@@ -1,91 +0,0 @@
|
||||
# This is mapping list between real user name/email and entry into sources files
|
||||
# If you don't want to have your real email appears here, just send a Pull Request to
|
||||
# replace the second field between <> with <secret>
|
||||
Laurent Destailleur <eldy@destailleur.fr> Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
Laurent Destailleur <eldy@destailleur.fr> eldy <eldy@destailleur.fr>
|
||||
Laurent Destailleur <eldy@destailleur.fr> Laurent Destailleur <ldestailleur@teclib.com>
|
||||
Laurent Destailleur <eldy@destailleur.fr> eldy10 <eldy10@master8.(none)>
|
||||
Laurent Destailleur <eldy@destailleur.fr> Laurent Destailleur <ephpcsdy@destailleur.fr>
|
||||
Regis Houssin <regis.houssin@capnetworks.com> Regis Houssin <regis@dolibarr.fr>
|
||||
Regis Houssin <regis.houssin@capnetworks.com> Régis Houssin <regishoussin@device5.home>
|
||||
Juanjo Menent <jmenent@2byte.es> simnandez <jmenent@2byte.es>
|
||||
Juanjo Menent <jmenent@2byte.es> Juanjo Menent <simnandez@gmail.com>
|
||||
Juanjo Menent <jmenent@2byte.es> Simnandez <jmenent@2byte.es>
|
||||
Juanjo Menent <jmenent@2byte.es> juanjo <juanjo@samsung>
|
||||
Juanjo Menent <jmenent@2byte.es> juanjo <juanjo@alienware>
|
||||
Marcos García de La Fuente <marcosgdf@gmail.com> Marcos García <marcosgdf@gmail.com>
|
||||
Marcos García de La Fuente <marcosgdf@gmail.com> Marcos García <marcosgdf@gmail.com>
|
||||
Florian Henry <florian.henry@open-concept.pro> fhenry <florian.henry@open-concept.pro>
|
||||
Florian Henry <florian.henry@open-concept.pro> Florian HENRY <florian.henry@open-concept.pro>
|
||||
Florian Henry <florian.henry@open-concept.pro> FHenry <florian.henry.mail@gmail.com>
|
||||
Florian Henry <florian.henry@open-concept.pro> Florian HENRY <florian.henry@open-conept.pro>
|
||||
Florian Henry <florian.henry@open-concept.pro> FHenry <florian.henry@open-concept.pro>
|
||||
Florian Henry <florian.henry@open-concept.pro> HENRY Florian <florian.henry@open-concept.pro>
|
||||
Alexandre Spangaro <aspangaro.dolibarr@gmail.com> aspangaro <aspangaro.dolibarr@gmail.com>
|
||||
Alexandre Spangaro <aspangaro.dolibarr@gmail.com> Spangaro Alexandre <aspangaro.dolibarr@gmail.com>
|
||||
Alexandre Spangaro <aspangaro.dolibarr@gmail.com> Alexandre SPANGARO <aspangaro.dolibarr@gmail.com>
|
||||
Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> Raphaël Doursenaud <rdoursenaud@free.fr>
|
||||
Philippe Grand <philippe.grand@atoo-net.com> Grand Philippe <contact@atoo-net.com>
|
||||
Philippe Grand <philippe.grand@atoo-net.com> Philippe GRAND <philippe.grand@atoo-net.com>
|
||||
Philippe Grand <philippe.grand@atoo-net.com> philippe grand <philippe.grand@atoo-net.com>
|
||||
Philippe Grand <philippe.grand@atoo-net.com> philippe <philippe.grand@atoo-net.com>
|
||||
Philippe Grand <philippe.grand@atoo-net.com> unknown <Philippe@grandoc.(none)>
|
||||
Philippe Grand <philippe.grand@atoo-net.com> philippe <philippe@PC-de-philippe>
|
||||
Philippe Grand <philippe.grand@atoo-net.com> Philippe Grand <contact@atoo-net.com>
|
||||
Jean-François Ferry <jfefe@aternatik.fr> jfefe <jfefe@aternatik.fr>
|
||||
Jean-François Ferry <jfefe@aternatik.fr> jfefe <jf.ferry@aternatik.fr>
|
||||
Jean-François Ferry <jfefe@aternatik.fr> JF FERRY <jfefe@aternatik.fr>
|
||||
Jean-François Ferry <jfefe@aternatik.fr> JF FERRY <meos@devmachine.(none)>
|
||||
Charles Benke <charles.fr@benke.fr> BENKE Charles <charles.fr@benke.fr>
|
||||
Charles Benke <charles.fr@benke.fr> BENKE Charlie <charles.fr@benke.fr>
|
||||
Charles Benke <charles.fr@benke.fr> defrance69 <charles.fr@benke.fr>
|
||||
Maxime Kohlhaas <mko@atm-consulting.fr> MAxime Kohlhaas <maxime@atm-consulting.fr>
|
||||
Frédéric France <frederic.france@free.fr> Frédéric FRANCE <frederic.france@free.fr>
|
||||
Frédéric France <frederic.france@free.fr> frederic34 <frederic.france@free.fr>
|
||||
Frédéric France <frederic.france@free.fr> FRANCE Frédéric <frederic.france@free.fr>
|
||||
Frédéric France <frederic.france@free.fr> frederic34 <fred@ubuntuserver.(none)>
|
||||
Cyrille de Lambert <cyrille.delambert@auguria.net> cdelambert <cdelambert>
|
||||
Cédric Gross <c.gross@kreiz-it.fr> KreizIT <KreizIT@users.noreply.github.com>
|
||||
Cédric Gross <c.gross@kreiz-it.fr> Cedric <c.gross@kreiz-it.fr>
|
||||
Cédric Gross <c.gross@kreiz-it.fr> Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
Jean Heimburger <jean@tiaris.info> jean <jean@tiaris.info>
|
||||
Jean Heimburger <jean@tiaris.info> tiaris <tiaris>
|
||||
Benoit Mortier <benoit.mortier@opensides.be> opensides <opensides>
|
||||
Eric Seigne <contact@ryxeo.com> erics <erics>
|
||||
Jean-Louis Bergamo <jl@bergamo.fr> jlb <jlb>
|
||||
Remco Gerbrands <remco@artoge.nl> r2gnl <r2gnl>
|
||||
Phf <phf@atm-consulting.fr> phf <phf@atm-consulting.fr>
|
||||
Yannick Warnier <ywarnier@beeznest.org> ywarnier <ywarnier>
|
||||
Jerome Warnier <jwarnier@beeznest.org> jwarnier <jwarnier>
|
||||
Franky Van Liedekerke <liedekef@telenet.be> liedekef <liedekef>
|
||||
Lalaina Rasamoelina <lalaina.rasamoelina@biblibre.com> lalaina rasamoelina <lalaina.rasamoelina@biblibre.com>
|
||||
Marc Ocebo <marc_ocebo> marc_ocebo <marc_ocebo>
|
||||
Unknown <secret> box7890 <box7890>
|
||||
Unknown <secret> beedauchon <beedauchon>
|
||||
Loic <secret> loic <loic>
|
||||
Christophe Combelle <ccomb>
|
||||
Unknown <secret> activdev <activdev>
|
||||
Unknown <secret> bouba <bouba>
|
||||
Unknown <secret> bcroq <bcroq>
|
||||
Unknown <secret> dutoit <dutoit>
|
||||
Unknown <secret> bureau2crea <bureau2crea>
|
||||
Unknown <secret> unknown <mne02@.modula71.local>
|
||||
Simon Tosser <secret> simontosser <simontosser>
|
||||
Unknown <secret> tipaul <tipaul>
|
||||
Raphaël Bertrand <secret> raphael_bertrand <raphael_bertrand>
|
||||
Claudio Aschieri <c.aschieri@19.coop> cla <c.aschieri@19.coop>
|
||||
Tommaso Basilici <t.basilici@19.coop> kaos <t.basilici@19.coop>
|
||||
Tommaso Basilici <t.basilici@19.coop> Tommaso Basilici <t.basilici@19.coop>
|
||||
Faust <faust@19.coop> faust <faust@19.coop>
|
||||
Ferran Marcet <secret> fmarcet <fmarcet@imedia>
|
||||
Geoffrey Girard <geoffre.girard@atm-consulting.fr> geoffrey.girard <geoffre.girard@atm-consulting.fr>
|
||||
Bernard Paquier <eshop.bpaquier@gmail.com> BadPixxel <eshop.bpaquier@gmail.com>
|
||||
Patrick Delcroix <delcroip@gmail.com> delcroix Patrick <delcroip@gmail.com>
|
||||
Damien Clochard <damien@dalibo.com> damien clochard <damien@dalibo.info>
|
||||
Damien Clochard <damien@dalibo.com> damien clochard <damien@dalibo.com>
|
||||
Grégory David <groolot@groolot.net> Grégory DAVID <groolot@groolot.net>
|
||||
Grégory David <groolot@groolot.net> Gregory DAVID <groolot@groolot.net>
|
||||
Baffir Abbes <bafbes@users.noreply.github.com> bafbes <bafbes@users.noreply.github.com>
|
||||
Kevin Guerrier <guerrier.k@gmail.com> GUERRIER Kevin <guerrier.k@gmail.com>
|
||||
Remy Younes <ryounes@gmail.com> remy <ryounes@gmail.com>
|
||||
Estephe Loridan <github@estephe.me> Estephe L. <github@estephe.me>
|
||||
@@ -5,13 +5,12 @@ imports:
|
||||
|
||||
filter:
|
||||
excluded_paths:
|
||||
- build/*
|
||||
- dev/*
|
||||
- doc/*
|
||||
- test/*
|
||||
paths:
|
||||
- htdocs/*
|
||||
- scripts/*
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'test/*'
|
||||
- 'htdocs/includes/*'
|
||||
paths: { }
|
||||
|
||||
tools:
|
||||
# php_analyzer. Doc on https://scrutinizer-ci.com/docs/tools/php/php-analyzer/
|
||||
@@ -19,18 +18,15 @@ tools:
|
||||
enabled: true
|
||||
extensions:
|
||||
- php
|
||||
dependency_paths:
|
||||
- htdocs/includes/
|
||||
dependency_paths: { }
|
||||
filter:
|
||||
excluded_paths:
|
||||
- build/*
|
||||
- dev/*
|
||||
- doc/*
|
||||
- test/*
|
||||
- htdocs/includes/*
|
||||
paths:
|
||||
- htdocs/
|
||||
- scripts/
|
||||
- 'build/*'
|
||||
- 'dev/*'
|
||||
- 'doc/*'
|
||||
- 'test/*'
|
||||
- 'htdocs/includes/*'
|
||||
paths: { }
|
||||
config:
|
||||
parameter_reference_check:
|
||||
enabled: true
|
||||
|
||||
54
.travis.yml
@@ -8,9 +8,6 @@ notifications:
|
||||
on_success: never # [always|never|change] default: change
|
||||
on_failure: change # [always|never|change] default: always
|
||||
|
||||
addons:
|
||||
postgresql: "9.3"
|
||||
|
||||
services:
|
||||
- memcached # will start memcached
|
||||
|
||||
@@ -18,15 +15,9 @@ services:
|
||||
language: php
|
||||
php:
|
||||
# - "5.2" is not supported because pyrus to install PHP_Codesniffer is not available
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: 7.0
|
||||
- "5.3"
|
||||
- "5.4"
|
||||
- "5.5"
|
||||
|
||||
env:
|
||||
- DB=mysql
|
||||
@@ -41,12 +32,10 @@ before_script:
|
||||
# - echo Update composer
|
||||
# - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update
|
||||
- echo PHPUnit version
|
||||
- which phpunit
|
||||
- phpunit --version
|
||||
- echo Install phpcs then show installed rules
|
||||
- pyrus install pear/PHP_CodeSniffer
|
||||
- phpenv rehash
|
||||
- which phpcs
|
||||
- phpcs --version
|
||||
- phpcs -i
|
||||
- echo Create dir $(pwd)/htdocs/documents
|
||||
@@ -66,24 +55,7 @@ before_script:
|
||||
- sh -c "if [ '$PHPV' = '5.4' ]; then echo 'zend_extension_ts = xdebug.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi"
|
||||
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
- echo Mysql version
|
||||
# INSTALL MYSQL 5.6
|
||||
# (https://github.com/piwik/piwik/commit/20bd2e1c24e5d673dce3feb256204ad48c29f160)
|
||||
# TODO: Remove when mysql 5.6 is provided by travis.
|
||||
# Otherwise, our migrations will raise a syntax error.
|
||||
- "sudo apt-get remove mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5"
|
||||
- "sudo apt-get autoremove"
|
||||
- "sudo apt-get install libaio1"
|
||||
- "wget -O mysql-5.6.14.deb http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb/from/http://cdn.mysql.com/"
|
||||
- "sudo dpkg -i mysql-5.6.14.deb"
|
||||
- "sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql.server"
|
||||
- "sudo ln -s /opt/mysql/server-5.6/bin/* /usr/bin/"
|
||||
- "sudo sed -i'' 's/table_cache/table_open_cache/' /etc/mysql/my.cnf"
|
||||
- "sudo sed -i'' 's/log_slow_queries/slow_query_log/' /etc/mysql/my.cnf"
|
||||
- "sudo sed -i'' 's/basedir[^=]\\+=.*$/basedir = \\/opt\\/mysql\\/server-5.6/' /etc/mysql/my.cnf"
|
||||
- "sudo /etc/init.d/mysql.server start"
|
||||
- mysql --version
|
||||
- mysql -e "SELECT VERSION();"
|
||||
# /END MYSQL 5.6- mysql --version
|
||||
- echo Init database
|
||||
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS myapp_test;' -U postgres; fi"
|
||||
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE myapp_test;' -U postgres; fi"
|
||||
@@ -112,8 +84,6 @@ before_script:
|
||||
- sudo cat /etc/apache2/sites-available/default
|
||||
- sudo /etc/init.d/apache2 restart
|
||||
- wget http://localhost/
|
||||
- sudo cat /etc/apache2/envvars
|
||||
- sudo cat /var/log/apache2/error.log
|
||||
- cat index.html
|
||||
|
||||
|
||||
@@ -121,16 +91,14 @@ before_script:
|
||||
script:
|
||||
- cd htdocs/install
|
||||
- date
|
||||
# - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade340350.log
|
||||
# - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade340350-2.log
|
||||
- php upgrade.php 3.5.0 3.6.0 ignoredbversion > upgrade350360.log
|
||||
- php upgrade2.php 3.5.0 3.6.0 ignoredbversion > upgrade350360-2.log
|
||||
- php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log
|
||||
- php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log
|
||||
- php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log
|
||||
# - cat upgrade370380.log
|
||||
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
|
||||
# - cat upgrade370380-2.log
|
||||
# - php upgrade.php 3.4.0 3.5.0 ignoredbversion > upgrade.log
|
||||
# - php upgrade2.php 3.4.0 3.5.0 ignoredbversion > upgrade2.log
|
||||
- php upgrade.php 3.5.0 3.6.0 ignoredbversion >> upgrade.log
|
||||
- php upgrade2.php 3.5.0 3.6.0 ignoredbversion >> upgrade2.log
|
||||
- php upgrade.php 3.6.0 3.7.0 ignoredbversion >> upgrade.log
|
||||
# - cat upgrade360370.log
|
||||
- php upgrade2.php 3.6.0 3.7.0 ignoredbversion >> upgrade2.log
|
||||
# - cat upgrade2.log
|
||||
- cd ../..
|
||||
- date
|
||||
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
|
||||
20
.tx/config
@@ -1,6 +1,6 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
lang_map = uz: uz_UZ, sw: sw_SW, sr@latin: sr_RS
|
||||
lang_map = uz: uz_UZ, sw: sw_SW
|
||||
|
||||
[dolibarr.accountancy]
|
||||
file_filter = htdocs/langs/<lang>/accountancy.lang
|
||||
@@ -146,12 +146,6 @@ source_file = htdocs/langs/en_US/holiday.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.incoterm]
|
||||
file_filter = htdocs/langs/<lang>/incoterm.lang
|
||||
source_file = htdocs/langs/en_US/incoterm.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.install]
|
||||
file_filter = htdocs/langs/<lang>/install.lang
|
||||
source_file = htdocs/langs/en_US/install.lang
|
||||
@@ -182,12 +176,6 @@ source_file = htdocs/langs/en_US/link.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.loan]
|
||||
file_filter = htdocs/langs/<lang>/loan.lang
|
||||
source_file = htdocs/langs/en_US/loan.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.mailmanspip]
|
||||
file_filter = htdocs/langs/<lang>/mailmanspip.lang
|
||||
source_file = htdocs/langs/en_US/mailmanspip.lang
|
||||
@@ -248,9 +236,9 @@ source_file = htdocs/langs/en_US/paypal.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.printing]
|
||||
file_filter = htdocs/langs/<lang>/printing.lang
|
||||
source_file = htdocs/langs/en_US/printing.lang
|
||||
[dolibarr.printipp]
|
||||
file_filter = htdocs/langs/<lang>/printipp.lang
|
||||
source_file = htdocs/langs/en_US/printipp.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
How to contribute to Dolibarr
|
||||
=============================
|
||||
|
||||
Bug reports and feature requests
|
||||
--------------------------------
|
||||
|
||||
*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum).
|
||||
|
||||
**NEW**
|
||||
|
||||
Issues are now managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues).
|
||||
|
||||
1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem.
|
||||
2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request.
|
||||
3. Report with as much detail as possible ([Use screenshots or even screencasts whenever possible](https://help.github.com/articles/issue-attachments)).
|
||||
|
||||
We're still figuring out how to migrate old issues to GitHub. In the meantime, they are still available at [Doliforge](https://doliforge.org/projects/dolibarr).
|
||||
|
||||
<a name=code></a>Code
|
||||
---------------------
|
||||
|
||||
### Basic workflow
|
||||
|
||||
1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr).
|
||||
2. Clone your fork.
|
||||
3. Choose a branch(See the [Branches](#branches) section below).
|
||||
4. Commit and push your changes.
|
||||
5. [Make a pull request](https://help.github.com/articles/creating-a-pull-request).
|
||||
|
||||
### <a name=branches></a>Branches
|
||||
|
||||
Unless you're fixing a bug, all pull requests should be made against the *develop* branch.
|
||||
|
||||
If you're fixing a bug, it is preferred that you cook your fix and pull request it
|
||||
against the oldest version affected that's still supported.
|
||||
|
||||
We officially support versions N, N − 1 and N − 2 for N the latest version available.
|
||||
|
||||
Choose your base branch accordingly.
|
||||
|
||||
### General rules
|
||||
Please don't edit the ChangeLog file. A project manager will update it from your commit messages.
|
||||
|
||||
### Commits
|
||||
Use clear commit messages with the following structure:
|
||||
|
||||
<pre>
|
||||
FIX|Fix #456 Short description (where #456 is number of bug fix, if it exists. In upper case to appear into ChangeLog)
|
||||
or
|
||||
CLOSE|Close #456 Short description (where #456 is number of feature request, if it exists. In upper case to appear into ChangeLog)
|
||||
or
|
||||
NEW|New Short description (In upper case to appear into ChangeLog, use this if you add a feature not tracked, otherwise use CLOSE #456)
|
||||
or
|
||||
Short description (when the commit is not introducing feature nor closing a bug)
|
||||
|
||||
Long description (Can span accross multiple lines).
|
||||
</pre>
|
||||
|
||||
### Pull Requests
|
||||
When submitting a pull request, use same rule than Commits. With upper case keyword to appear into ChangeLog.
|
||||
|
||||
|
||||
### Resources
|
||||
[Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation)
|
||||
|
||||
Translations
|
||||
------------
|
||||
The source language (en_US) is maintained in the repository. See the [Code](#code) section above.
|
||||
|
||||
All other translations are managed online at [Transifex](https://www.transifex.com/projects/p/dolibarr).
|
||||
|
||||
Join an existing translation team or create your own and translate into the interface.
|
||||
|
||||
Your translations will be available in the next major release.
|
||||
|
||||
### Resources
|
||||
[Translator documentation](http://wiki.dolibarr.org/index.php/Developer_documentation)
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
The project's documentation is maintained on the [Wiki](http://wiki.dolibarr.org/index.php).
|
||||
|
||||
*You need to create an account before being able to edit.*
|
||||
|
||||
34
COPYRIGHT
@@ -12,27 +12,23 @@ Dolibarr uses some external libraries released under different licenses. This is
|
||||
Component Version License GPL Compatible Usage
|
||||
-------------------------------------------------------------------------------------
|
||||
PHP libraries:
|
||||
AdoDb-Date 0.33 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
AdoDb-Date 0.32 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
ChromePHP 4.3.3 Apache Software License 2.0 Yes Return server log to chrome browser console
|
||||
CKEditor 4.3.3 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management
|
||||
FPDI 1.4.2 Apache Software License 2.0 Yes PDF templates management
|
||||
FPDF_TPL 1.2 Apache Software License 2.0 Yes PDF templates management
|
||||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||
Mobiledetect 2.8.3 MIT License Yes Detect mobile devices browsers
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
|
||||
PHPExcel 1.8.0 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
PHPExcel 1.7.8 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
|
||||
TCPDF 6.2.6 LGPL-3+ Yes PDF generation
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
TCPDF 6.0.093 LGPL-3+ Yes PDF generation
|
||||
|
||||
JS libraries:
|
||||
jQuery 1.11.3 MIT License Yes JS library
|
||||
jQuery UI 1.11.4 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery 1.8.2 MIT License Yes JS library
|
||||
jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||
jQuery DataTables 1.9.4 BSD Yes JS library for tables output
|
||||
jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files
|
||||
@@ -43,13 +39,12 @@ jQuery jNotify 1.1.00 Apache Software License 2.0 Yes
|
||||
jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery Layout 1.4.3 GPL and MIT License Yes JS library plugin Layout
|
||||
jQuery Layout 1.3.0rc30.74 GPL and MIT License Yes JS library plugin Layout (RC-29.15)
|
||||
jQuery Mobile 1.3.0 GPL and MIT License Yes JS library for smartphone (not used)
|
||||
jQuery TableDnD 0.6 GPL and MIT License Yes JS library plugin TableDnD (to reorder table rows)
|
||||
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
||||
jQuery Tiptip 1.3 GPL and MIT License Yes JS library for tooltips
|
||||
jsGantt 1.2 BSD License Yes JS library (to build Gantt reports)
|
||||
JsTimezoneDetect 1.0.4 MIT Licence Yes JS library to detect user timezone
|
||||
|
||||
For licenses compatibility informations:
|
||||
http://www.fsf.org/licensing/licenses/index_html
|
||||
@@ -59,11 +54,7 @@ Copyright
|
||||
---------
|
||||
|
||||
Copyright (C) 2015
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
- Marcos García <marcosgdf@gmail.com>
|
||||
- Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
- Frederic France <frederic.france@free.fr>
|
||||
- Regis Houssin <regis.houssin@capnetworks.com>
|
||||
|
||||
Copyright (C) 2014
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
@@ -75,8 +66,7 @@ Copyright (C) 2014
|
||||
- Regis Houssin <regis.houssin@capnetworks.com>
|
||||
- Maxime Kohlhaas <mko@atm-consulting.fr>
|
||||
- Juanjo Menent <jmenent@2byte.es>
|
||||
- Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
- Frederic France <frederic.france@free.fr>
|
||||
- Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
|
||||
Copyright (C) 2013
|
||||
- Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
@@ -89,7 +79,7 @@ Copyright (C) 2013
|
||||
- Maxime Kohlhaas <mko@atm-consulting.fr>
|
||||
- Juanjo Menent <jmenent@2byte.es>
|
||||
- Adolfo Segura <adolfo.segura@gmail.com>
|
||||
- Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
- Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
|
||||
Copyright (C) 2012
|
||||
- Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
@@ -103,7 +93,7 @@ Copyright (C) 2012
|
||||
- Maxime Kohlhaas <mko@atm-consulting.fr>
|
||||
- Juanjo Menent <jmenent@2byte.es>
|
||||
- Nicolas Péré <nicolas@amarok2.net>
|
||||
- Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
- Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
|
||||
Copyright (C) 2011
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
|
||||
288
ChangeLog
@@ -5,295 +5,10 @@ English Dolibarr ChangeLog
|
||||
WARNING: Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
|
||||
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
|
||||
You may also experience troubles with Mysql 5.5.41 with error "Lost connection" during migration.
|
||||
Upgrading to any other version or any other database system is abolutely required BEFORE trying
|
||||
Upgrading to any other version or database system is abolutely required BEFORE trying to
|
||||
make a Dolibarr upgrade.
|
||||
|
||||
|
||||
***** ChangeLog for 3.8.1 compared to 3.8.0 *****
|
||||
FIX: #3521 postgresql migration error
|
||||
FIX: #3524
|
||||
FIX: #3529
|
||||
FIX: #3530
|
||||
FIX: #3533
|
||||
FIX: #3533 Load categories language
|
||||
FIX: #3534
|
||||
FIX: #3572 Impossible to attach project in order
|
||||
FIX: #3599 Not saving legal form
|
||||
FIX: #3606
|
||||
FIX: #3607 Better categories setting and unsetting
|
||||
FIX: #3628
|
||||
FIX: #3630 - Wrong balance report when module salaries and donation disabled
|
||||
FIX: Add a test to save life when ref of object (invoice ref, order ref, ...) was empty. The was no way to go back to a clean situation, even after vaidating again the object.
|
||||
FIX: Admin fiche inter page do not take good action
|
||||
FIX: Always use type send in parameters in showCategories method
|
||||
FIX: avoid SQL error in getValueFrom common object when all params are not send
|
||||
FIX: avoid SQL error when no sortfield send to method
|
||||
FIX: bad link into project box
|
||||
FIX: Bad title line in project view when using jmobile
|
||||
FIX: Bad translation key for project "Overview"
|
||||
FIX: Can create Proposal on close thridparty #3526
|
||||
FIX: Can't change state on a contact
|
||||
FIX: Can't change the admin with default setup
|
||||
FIX: Can't delete thirdparty if there is some discounts
|
||||
FIX: Can't reopen a canceled invoice.
|
||||
FIX: Creation of tables or keys must not be done with a random order.
|
||||
FIX: debian install when module mysqli is not installed.
|
||||
FIX: Description of tags was mandatory in edit mode but not in create mode. Should not be mandatory.
|
||||
FIX: display error on extrafields on ficheinter
|
||||
FIX: Email selector contact must not include inactive contact
|
||||
FIX: error in SQL due to a previous fix
|
||||
FIX: Error retrieving customer prices
|
||||
FIX: Event from ical stream should not be movable into calendar view
|
||||
FIX: facturestat bad sql when customer view is limited
|
||||
FIX: Filter on status of thirdparty list and bad encoding of url
|
||||
FIX: icon into export profile may be not correctly output
|
||||
FIX: Init into bad var
|
||||
FIX: Link of project must be cickable if user has permission to read all projects FIX: Missing information into the alt of project picto
|
||||
FIX: List of project for user that are restrited as sale repreentative to some thirdparties.
|
||||
FIX: Mass Mailing activity don't display all status
|
||||
FIX: Missing contracts into list in page of Refering objects of a thirdparty.
|
||||
FIX: Missing menu entry for list of thirdparties when using auguria menu manager
|
||||
FIX: Missing validate button if permission are not valid.
|
||||
FIX: New adherent from, always redirect on entity
|
||||
FIX: not closing CSS.
|
||||
FIX: not responsive part for project page
|
||||
FIX: Only are showing one object linked
|
||||
FIX: order ref must not be translated
|
||||
FIX: Payment form for paypal and paybox was not centered.
|
||||
FIX: Pb into pagination scroll widget FIX: Style of previous-next card when using dolidroid
|
||||
FIX: Regression on bad use of fk_account showing the bad bank account on PDF.
|
||||
FIX: Removed warnings
|
||||
FIX: remove twice same test
|
||||
FIX: select of project using ajax autocomplete option
|
||||
FIX: sortder field was missing so manually added values were moved to begin.
|
||||
FIX: Syntax error in Debian Apache configuration
|
||||
FIX: The admin flag is mising.
|
||||
FIX: The filter on thirdparty prices should be visible if there is at least one thirdparty price.
|
||||
FIX: Thirdparty is missing on card
|
||||
FIX: update2.php test res befre assign it
|
||||
FIX: When delete actioncomm also delete actioncomm_resources
|
||||
FIX: when editing time spent, date of line suggested was a rubbish value
|
||||
FIX: When filter with empty status, by default get canceled status (-1)
|
||||
FIX: When update a member login for a member linked to a user, the login of user was not sync (not updated).
|
||||
FIX: Wizard for restore does not show import command
|
||||
|
||||
***** ChangeLog for 3.8 compared to 3.7.* *****
|
||||
For users:
|
||||
FIX: #2519
|
||||
FIX: #2758 Product::update sets product note to "null" when $prod->note is null
|
||||
FIX: #2832: Fixed a problem with special characters in expense report PDF model
|
||||
FIX: #2856 : Wrong table design
|
||||
FIX: #2901
|
||||
FIX: #2957 : missing $langs object for trigger
|
||||
FIX: #2983 Load gravatar avatar images securely over HTTPS
|
||||
FIX: #2987: removed dead function moneyMeter()
|
||||
FIX: #3009: Better filtering to prevent SQL injection
|
||||
FIX: #3009: Better filtering to prevent SQL injection
|
||||
FIX: #3091 TotalHT amount in supplier order is bold unlike the rest of Dolibarr
|
||||
FIX: #3138 - Too much visible thing when access is denied on public pages
|
||||
FIX: #3173 Overlapping of shipment ref
|
||||
FIX: Adding 5 more choice link into survey module was not working with chrome
|
||||
FIX: bad calculation for stock value
|
||||
FIX: Bad link to login page into email for password renewal.
|
||||
FIX: Bad logo for status "Do not contact" of thirdparty.
|
||||
FIX: Bad variable usage
|
||||
FIX: Better management error into the color conversion functions
|
||||
FIX: [bug #1883] missing field in SQL installation
|
||||
FIX: Bug on order and supplier invoice numeration mask when use supplier code
|
||||
FIX: Bug on order and supplier invoice numeration mask when use supplier code
|
||||
FIX: button create payment hide if tax amount is less than 1
|
||||
FIX: can receive new batch product on supplier order
|
||||
FIX: can show print page after product save
|
||||
FIX: Close #2835 Customer prices of a product shows incorrect history order
|
||||
FIX: Close #2837 Product list table column header does not match column body
|
||||
FIX: Close bug #2855 Wrong translation key in localtax report page
|
||||
FIX: Close bug #2861 Undefined variable $res when migrating from 3.6.2 to 3.7.0
|
||||
FIX: Close bug #2891 Category hooks do not work
|
||||
FIX: Close bug #2900 Courtesy title is not stored in create thirdparty form
|
||||
FIX: Close bug #2976: "Report" tab is the current tab but it is not marked as selected by the UI
|
||||
FIX: Correct migration script
|
||||
FIX: create contact with extrafiel is null when it is require
|
||||
FIX: Description of contract line was not visible.
|
||||
FIX: Correct path of loan class
|
||||
FIX: Correct problem field with note - Add note_private & use wysiwyg editor
|
||||
FIX: Edit in place of "Outstanding Limit"
|
||||
FIX: Module Expense Report - Correct init
|
||||
FIX: Update licence to GPLv3
|
||||
FIX: End log must use same level then start log.
|
||||
FIX: event for restricted user was restricted if company null
|
||||
FIX: event not linked to contact on creation
|
||||
FIX: Export of tags for contact and member
|
||||
FIX: extrafields required on thirdparty
|
||||
FIX: Force ref
|
||||
FIX: Function expects an int, not a boolean
|
||||
FIX: Function was expecting a boolean not a string
|
||||
FIX: hide category if it's not enable
|
||||
FIX: If supplier invoice block linked element is display after other block total HT amount is not reset to 0 and sum other block (like customer orders values)
|
||||
FIX: jdate returning -62169955200 on x64 machine
|
||||
FIX: Let ability to use IDPROF verifications even if new entry is "private"
|
||||
FIX: migration error
|
||||
FIX: moved built-in bug report system to GitHub Issues
|
||||
FIX: Moved code to where the variable is defined
|
||||
FIX: No check warehouse is provided if module stock is not enabled.
|
||||
FIX: Payed invoices are showed as canceled FIX: Bad date filter on customer order
|
||||
FIX: Ref/label of product on contract line was not visible, nor into page, nor into PDF.
|
||||
FIX: Removed concatenation on undeclared variable
|
||||
FIX: Remove deprecated property 'libelle' on product object
|
||||
FIX: Replaced some deprecated call
|
||||
FIX: Replaced some deprecated property
|
||||
FIX: Save of filters into export profiles failed.
|
||||
FIX: "script" balise with wrong syntax
|
||||
FIX: send mail, copy sendto don't read the list of contact
|
||||
FIX: top links menu have target attribute with wrong value
|
||||
FIX: total amount in tpl linked object are not reset
|
||||
FIX; Unknown field 'sc.fk_soc' in field list
|
||||
FIX: update usergroup name
|
||||
FIX: Variable declared boolean
|
||||
FIX: Variable might not be traversable
|
||||
FIX: We did a test on a permission to export contract when permission did not exists.
|
||||
FIX: when mailing is deleted, the targets list was kept in database
|
||||
FIX: when multicompany was enabled, this function didn't check just on the good entity (problem when both company use same mask)
|
||||
FIX: When we automatically creta an order from a proposal with workflow module, if some extrafields of propal don't exist in order object, insertExtraFields() function tries to insert extrafields in unexistant column of commande_extrafields table.
|
||||
FIX: When we clone a propal, if it has a project which is not assigned to a third, it was not on new propal because fk_project was always set to empty string if new propal is for another third.
|
||||
FIX: when we create an agenda event with "Not applicable" status, it is automatically saved with "To do" status
|
||||
FIX: width multiselect
|
||||
FIX: Wrong type hinting
|
||||
FIX: XSS security using the onerror and missing escapement on type of member page.
|
||||
FIX: Missing visibility of static property
|
||||
NEW: Add a button to purge criteria in user list
|
||||
NEW: add all assigned users and all extrafields data in new event when we createFromClone
|
||||
NEW: Add a new component to select categories/tags from the main edit page of product. The dedicated tab is also removed.
|
||||
NEW: Add a search field and report on hrm area
|
||||
NEW: Add a tab document in donation card
|
||||
NEW: Add bank account owner in invoice/proposal/orders footer
|
||||
NEW: Add button to purge search criteria into list
|
||||
NEW: Add close date and user for projects.
|
||||
NEW: Add company information into category contact export
|
||||
NEW: Add current salary on list of payment
|
||||
NEW: add date value filter on account records list
|
||||
NEW: Add exemple of setup for multitail to render dolibarr log files
|
||||
NEW: Add filter on status on invoice list
|
||||
NEW: Add filter on task ref and task label into list of tasks
|
||||
NEW: Add filter on user contact or user task into task list
|
||||
NEW: Add gender property managed on user card FIX: Better error messages when uploading photo of user when permission to write are not granted
|
||||
NEW: Add help tooltips on fields of dictionary edit pages. Fix: visible list of tasks are for opened project only.
|
||||
NEW: Add hidden option MAIN_MAILFORM_DISABLE_ENTERKEY to disable the key enter into the form to send email.
|
||||
NEW: add hook in send mail
|
||||
NEW: Add hooks on list of members to allow an external module to add more fields into list view.
|
||||
NEW: Add hooks to allow an external module to complete list of events into calendar views.
|
||||
NEW: Add opportunity amount on project card.
|
||||
NEW: Add option THEME_ELDY_DISABLE_IMAGE to disable images into menu eldy.
|
||||
NEW: add PDF icon on linked element into project
|
||||
NEW: add "productpricecard" hook and uniformize code
|
||||
NEW: Add ref and label of project into export
|
||||
NEW: Add search box for supplier order search.
|
||||
NEW: Add status into filters of graph
|
||||
NEW: Add tab document on salaries payment
|
||||
NEW: A link to the bugtracker can be enabled in the GUI
|
||||
NEW: A module can add its entries into cron module.
|
||||
NEW: autofocus on product selection dropdown list or search field
|
||||
NEW: Backup and restore tool is easier to use
|
||||
NEW: Can add all user of a project as user of a task, in one step.
|
||||
NEW: Can add project search on left menu search area
|
||||
NEW: Can assign a task to yourself to have it appear on timesheet
|
||||
NEW: Can close a project that has draft status with no need to switch it to validate status before.
|
||||
NEW: Can edit Background color for Top menu and Background color for table title line (works only with theme menu eldy).
|
||||
NEW: Can edit email template using WYSIWYG editor
|
||||
NEW: Can edit internal label of invoice even when closed (this is a private information)
|
||||
NEW: Can edit list of prospect status for customers/prospects. Add a new entry into dictionary table to manage list fo status. Removed deprecated files.
|
||||
NEW: Can filter on contact status in prospect list. Removed deprecated menu entry.
|
||||
NEW: Can filter proposal on a tag of a product Enhance also the prototype test_arrays to include select form before table.
|
||||
NEW: Can filter proposal, orders or invoices with criteria "contain at least one product with following tag"
|
||||
NEW: Can install an external module from admin pages, if web server has permission for and if setup is ok for.
|
||||
NEW: Can search on customer order amount into customer order list.
|
||||
NEW: Can upload files on leave requests. Use more standard permissions.
|
||||
NEW: Can use a "|" to make a OR search on several different criterias into text filters of tables.
|
||||
NEW: Clean code into salary module, debug and add indexes NEW: Can filter on user list and salary payments on user with naural search.
|
||||
NEW: clone action on agenda events
|
||||
NEW: dev feature : replace conf filename with "conf" parameter on url by GET
|
||||
NEW: display linked object in edit mode when we create an event from an order, propal...
|
||||
NEW: Enhancement of module 'Notification by Email'. Show nb of notifications set. Can set several emails. Can set a threshold on amount for notifications. Add notification on supplier order validation.
|
||||
NEW: Enhance prototype, project list and proposal list with new hook to have an external module able to add more fields.
|
||||
NEW: Enhance the natural_search function so we can use it to search numeric fields with criteria with operator <>= inside (< 100, >= 1000)
|
||||
NEW: Enter amount for withdraws requests
|
||||
NEW: Feature request: A page to merge two thirdparties into one #2613
|
||||
NEW: Feature to build a merged pdf with all unpaid invoice can work for paid invoices.
|
||||
NEW: Filter "active" by default on user list. Fix label of permission of project module
|
||||
NEW: For a contract line, price is no more mandatory.
|
||||
NEW: Forms are using the tab look, even in creation mode.
|
||||
NEW: Hidden option THEME_ELDY_USE_HOVER is stable enough to become officialy visible into setup.
|
||||
NEW: If module salaries is on, you can set a hourly value for tome consumed by users. Each time a user enter its time consumed on a project, a calculation is done to provide the cost for human services. This value appears into the "Transversal view" of project.
|
||||
NEW: Implement option SUPPLIER_ORDER_USE_DISPATCH_STATUS to add a status into each dispathing line of supplier order to "verify" a reception is ok. Status of order can be set to "total/done" only if line is verified.
|
||||
NEW: Into the overview of projects, the name of thirdparty appears into combo lists of elements to link to project.
|
||||
NEW: Introduce option SUPPLIER_ORDER_DOUBLE_APPROVAL to allow 2 approvals to make a supplier order approved. Activating this option introduce a new permission to the second level approval.
|
||||
NEW: Introduce TCPDI as replacement of FPDI.
|
||||
NEW: List of recent modified supplier product prices in Supplier card
|
||||
NEW: Module notification should details of emails into confirm box, not only number.
|
||||
NEW: On page to see/edit contact of an ojbect, the status of contact is visible (for both external and internal users).
|
||||
NEW: Product stock and subproduct stock are independant
|
||||
NEW: Propal merge product card PDF into azur
|
||||
NEW: Rename install etape to step
|
||||
NEW: Replace category edition page on members with new select2 component.
|
||||
NEW: Show difference between timespent by everybody and time spent by user making timesheet into timesheet pages. NEW: Can enter start hours of task when creating timesheet
|
||||
NEW: Show last official stable version into system - update page.
|
||||
NEW: Show photo of logged user into login top right block. NEW: If no photo is available for user, we show a generic photo depending on gender
|
||||
NEW: [T1758] Merge bank card & account card
|
||||
NEW: [ task 1191 ] AJAX selector for projects
|
||||
NEW: [ task #851 ] Add a new field: Commercial name
|
||||
NEW: [ task #977 ] New option to manage product unit Migrated code from GPCSolutions/dolibarr:3.2-units branch and adapted for 3.8 with some improvements
|
||||
NEW: The line where mouse is over can be highlight with option THEME_ELDY_USE_HOVER (on by default)
|
||||
NEW: The notification module accept keyword __SUPERVISOR__ to send notification to supervisor of user.
|
||||
NEW: Thumbs for statistics on main page are fully clicable (not only link inside the thumb)
|
||||
NEW: Title of page project contains project ref and label
|
||||
NEW: update skeleton and class builder
|
||||
NEW: Use new select2 component for juridical status, country and state selection.
|
||||
NEW: Web service to create or update product can correct stock during creation/update.
|
||||
NEW: When creating order, proposal or invoice from thirdparty card, the project is asked during creation. A link to create project if it does not exists is also available. NEW: Uniformize form creation of proposal to add public and private notes during creation like done for order and invoice.
|
||||
NEW: When using transfer or correct stock from warehouse, after recording we go back to the warehouse page.
|
||||
NEW: Add Option to not change date on cloning project
|
||||
NEW: Add check list from table for extrafield type
|
||||
NEW: Use new combobox.
|
||||
NEW: Add hidden option MAXTABS_IN_CARD.
|
||||
NEW: A default label is suggested for stock correction and transfer instead of empty string.
|
||||
NEW: Add Weighted average price as default price for buying price for margin calculation. Add option MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
|
||||
NEW: Introduce option MAIN_HTML_TITLE to start to control format of html title content.
|
||||
NEW: Add extrafields on bank account cards.
|
||||
NEW: Added delay between mails in Newsletter module.
|
||||
NEW: [ task #1793 ] Create new permission to restrict commercial agent margin to logged user.
|
||||
NEW: Add experimental module ask supplier price to request supplier quotation.
|
||||
NEW: Add module batch management.
|
||||
|
||||
For translators:
|
||||
NEW: Update language files.
|
||||
NEW: When a translation is not available we always jump to en_US and only en_US.
|
||||
NEW: All language tranlsations (except source en_US) is now managed on https://www.transifex.com/projects/p/dolibarr/.
|
||||
FIX: Typo errors in translation.
|
||||
|
||||
For developers:
|
||||
NEW: Function yn can show a visual checkbox.
|
||||
NEW: Introduced select2 jquery plugin.
|
||||
NEW: Possibility to add javascript in main login page with "getLoginPageOptions" hook.
|
||||
NEW: possibility to defined a tab for all entities in module descriptor.
|
||||
NEW: add restler framework First step to build REST API into Dolibarr.
|
||||
NEW: add an explorer for REST API consultation & documentation.
|
||||
NEW: script to build API class from existing class.
|
||||
NEW: Add function dolCopyDir to copy directory with recursive content.
|
||||
NEW: Introduce function dolGetFirstLineOfText.
|
||||
|
||||
WARNING: Following changes may create regression for some external modules, but were necessary to make
|
||||
Dolibarr better:
|
||||
- Removed hook supplierorderdao into supplier order creation. This is a business event, so we must use the
|
||||
trigger ORDER_SUPPLIER_CREATE instead.
|
||||
- Hooks 'printLeftBlock' and 'formConfirm' are now compliant with hook development rules. They are
|
||||
"addreplace" hooks, so you must return content with "->resprints='mycontent'" and not with "return 'mycontent'"
|
||||
- All fields "fk_societe" and "fk_soc" are now named "fk_soc" (same name for all fields).
|
||||
- Method select_PriceBaseType and load_PriceBaseType were merged into selectPriceBaseType.
|
||||
- The triggers USER_LOGIN* are deprecated. They are still working but you should prefer use the
|
||||
hook afterLogin or afterLoginFailed instead.
|
||||
- The trigger USER_CREATE_FROM_CONTACT has been replace with USER_CREATE and property context is now filled
|
||||
to make difference between creation from contact or not.
|
||||
- Function get_exdir require now 6 parameters. This is to prepare a future feature.
|
||||
|
||||
***** ChangeLog for 3.7.2 compared to 3.7.1 *****
|
||||
FIX [ bug #2855 ] Wrong translation key in localtax report page
|
||||
FIX [ bug #1852 ] JS error when editing a customer order line
|
||||
@@ -456,7 +171,6 @@ For users:
|
||||
- Fix: [ bug #1535 ] Supplier invoice Extrafields are not shown
|
||||
- Fix: datepicker first day of week can be monday by setting into display setup
|
||||
- Fix: [ bug #575 ] GED doesn't works if there is "/" in a mask
|
||||
- Fix: [ task #1728 ] Deactivate RIB suggest in proposals / invoices / orders
|
||||
|
||||
For users, new experimental module (need to set feature level of instance to experimental to see them):
|
||||
- New: Module Accounting Expert to manage accountancy
|
||||
|
||||
14
Dockerfile
@@ -1,14 +0,0 @@
|
||||
FROM php:5.6-apache
|
||||
|
||||
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
|
||||
&& docker-php-ext-install gd
|
||||
|
||||
RUN docker-php-ext-install mysqli
|
||||
|
||||
COPY htdocs/ /var/www/html/
|
||||
|
||||
RUN chown -hR www-data:www-data /var/www/html
|
||||
|
||||
EXPOSE 80
|
||||
229
README.md
@@ -1,166 +1,151 @@
|
||||
# DOLIBARR ERP & CRM
|
||||
|
||||
Dolibarr ERP & CRM is a modern software to manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).
|
||||
|
||||
It's an Open Source software (wrote in PHP language) designed for small and medium companies, foundation and freelances.
|
||||
|
||||
You can freely use, study, modify or distribute it according to it's Free Software licence.
|
||||
|
||||
You can use it as a standalone application or as a web application to be able to access it from the Internet or a LAN.
|
||||
Dolibarr ERP & CRM is a modern software to manage your company or foundation activity (contacts, suppliers, invoices, orders, stocks, agenda, ...).It's an opensource software (wrote with PHP language) designed for small and medium companies, foundation and freelances. You can freely install, use and distribute it as a standalone application or as a web application to use it from every internet access and media.
|
||||
|
||||

|
||||
|
||||
|
||||
## LICENSE
|
||||
|
||||
Dolibarr is released 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 (GPL-3+).
|
||||
|
||||
See the [COPYING](COPYING) file for a full copy of the license.
|
||||
|
||||
Other licenses apply for some included dependencies. See [COPYRIGHT](COPYRIGHT) for a full list.
|
||||
|
||||
## INSTALLING
|
||||
## INSTALL
|
||||
|
||||
### Download
|
||||
If you have no technical knowledge, and you are looking for an autoinstaller to install Dolibarr ERP/CRM in few clicks, you must download DoliWamp (the all-in-one package of Dolibarr for Windows), DoliDeb (the all-in-one package of Dolibarr for Debian or Ubuntu) or DoliRpm (the all-in-one package of Dolibarr for Fedora, Redhat, Opensuse, Mandriva or Mageia).
|
||||
|
||||
Releases can be downloaded from [official website](http://www.dolibarr.org/).
|
||||
You can download this from the download area of [Official website] (<http://www.dolibarr.org/>)
|
||||
|
||||
### Simple setup
|
||||
If you already have installed a Web server and a Mysql database, you can install the standard version like this:
|
||||
|
||||
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in few clicks, you can use one of the packaged versions:
|
||||
- Uncompress the downloaded archive.
|
||||
|
||||
- DoliWamp for Windows
|
||||
- DoliDeb for Debian or Ubuntu
|
||||
- DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia
|
||||
- Copy directory "dolibarr" and all its files inside your web server root, or copy directory anywhere and set up your web server to use "dolibarr/htdocs" as root for a new web server virtual host (second choice need to be server administrator).
|
||||
|
||||
- Create an empty file "htdocs/conf/conf.php" and set permissions for your web server user (write permissions will be removed once install is finished).
|
||||
|
||||
- From your browser, call the dolibarr "install/" page.
|
||||
|
||||
### Advanced setup
|
||||
Url depends on choice made on first step:
|
||||
|
||||
You can use a Web server and a supported database (MySQL recommended) to install the standard version.
|
||||
http://localhost/dolibarr/htdocs/install/
|
||||
or
|
||||
|
||||
- Uncompress the downloaded archive
|
||||
- Copy directory "dolibarr" and all its files inside your web server root, or copy directory anywhere and set up your web server to use "dolibarr/htdocs" as root for a new web server virtual host (second choice need to be server administrator)
|
||||
- Create an empty file "htdocs/conf/conf.php" and set permissions for your web server user (write permissions will be removed once install is finished)
|
||||
- From your browser, go to the dolibarr "install/" page
|
||||
http://localhost/dolibarr/install/
|
||||
or
|
||||
|
||||
The URL will depends on choices made in the first step:
|
||||
|
||||
http://localhost/dolibarr/htdocs/install/
|
||||
|
||||
or
|
||||
|
||||
http://localhost/dolibarr/install/
|
||||
|
||||
or
|
||||
|
||||
http://yourdolibarrvirtualhost/install/
|
||||
http://yourdolibarrvirtualhost/install/
|
||||
|
||||
- Follow the installer instructions
|
||||
- Follow instructions provided by installer...
|
||||
|
||||
## UPGRADING
|
||||
|
||||
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
|
||||
- If you're upgrading from version x.y.z to x.y.w (only third number differs), there is no need to run any migration process.
|
||||
- If you're upgrading from a beta version or from any version x.y.z to any other where x or y number differs, you must call the Dolibarr "install/" page in your browser (this should be done automatically at first dolibarr access) and follow the upgrade process.
|
||||
|
||||
*Note: migration process can safely be done multiple times.*
|
||||
## UPGRADE
|
||||
|
||||
## NEWS
|
||||
To upgrade Dolibarr from an old version to this one:
|
||||
|
||||
See the [ChangeLog](ChangeLog) file.
|
||||
- Overwrite all old files inside old 'dolibarr' directory by files provided into new version package.
|
||||
|
||||
- If you came from version x.y.z to x.y.w (only third number differ), there is no need to run any migrate process.
|
||||
|
||||
- If you came from a beta version or from any version x.y.z to any other where x or y number differs, you must call the Dolibarr "install/" page in your browser (this should be done automatically at first dolibarr access).
|
||||
|
||||
## FEATURES
|
||||
This URL should looks like:
|
||||
|
||||
### General features
|
||||
- Users and groups with finely grained rights
|
||||
- Localization in most major languages
|
||||
- Very user friendly and easy to use
|
||||
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
|
||||
- Works with PHP 5.3+ and MySQL 4.1+ or PostgreSQL 8.1. (See requirements on the [Wiki](http://wiki.dolibarr.org/index.php/Prerequisite))
|
||||
- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites.
|
||||
- An easy to understand, maintain and code interfaces with your own information system (PHP with no heavy framework; trigger and hook architecture)
|
||||
- Support for country specific features:
|
||||
- Spanish Tax RE and ISPF
|
||||
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
|
||||
- Canadian double taxes (federal/province) and other countries using cumulative VAT
|
||||
- Tunisian tax stamp
|
||||
- Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
|
||||
- ...
|
||||
http://localhost/dolibarr/htdocs/install/
|
||||
or
|
||||
|
||||
### Main modules
|
||||
http://localhost/dolibarr/install/
|
||||
or
|
||||
|
||||
- Customers, Prospects and/or Suppliers directory
|
||||
- Products and/or Services catalog
|
||||
- Bank accounts management
|
||||
- Customer and Supplier Orders management
|
||||
- Commercial proposals management
|
||||
- Contracts management
|
||||
- Invoices management
|
||||
- Projects management
|
||||
- Events management
|
||||
- Payments management
|
||||
- Standing orders management
|
||||
- Stock management
|
||||
- Shipping management
|
||||
- Interventions management
|
||||
http://yourdolibarrhost/install/
|
||||
|
||||
Then choose the "update" option according to your case.
|
||||
Note: Migrate process can be ran safely several times.
|
||||
|
||||
|
||||
|
||||
## WHAT'S NEW
|
||||
|
||||
See ChangeLog file found into package.
|
||||
|
||||
|
||||
|
||||
## WHAT DOLIBARR CAN DO
|
||||
|
||||
### Main modules/features:
|
||||
|
||||
- Customers, Prospects or Suppliers directory.
|
||||
- Products and services catalog.
|
||||
- Bank accounts management.
|
||||
- Orders management.
|
||||
- Commercial proposals management.
|
||||
- Contracts management.
|
||||
- Invoices management.
|
||||
- Payments management.
|
||||
- Standing orders management.
|
||||
- Stock management.
|
||||
- Shipping management.
|
||||
- PDF or ODT generation for invoice, proposals, orders...
|
||||
- Agenda with ical and vcal export for third party tools integration
|
||||
- Electronic Document Management (EDM)
|
||||
- Foundations members management
|
||||
- Employee's holidays management
|
||||
- Mass emailing
|
||||
- Surveys
|
||||
- Point of Sale
|
||||
- …
|
||||
- Agenda with ical,vcal export for third tools integration.
|
||||
- EDM (Electronic Document Management).
|
||||
- Foundations members management.
|
||||
- Employee's holidays management.
|
||||
- Mass Emailing.
|
||||
- Realize surveys.
|
||||
- Point of Sale.
|
||||
|
||||
### Other modules
|
||||
### Other modules:
|
||||
|
||||
- Bookmarks management
|
||||
- Donations management
|
||||
- Reporting
|
||||
- Data export/import
|
||||
- Thirdparties and/or products categories
|
||||
- Barcodes support
|
||||
- Margin calculations
|
||||
- LDAP connectivity
|
||||
- ClickToDial integration
|
||||
- RSS integration
|
||||
- Skype integration
|
||||
- Payment platforms integration (PayBox, PayPal)
|
||||
- …
|
||||
- Bookmarks management.
|
||||
- Donations management.
|
||||
- Reporting.
|
||||
- Data export/import.
|
||||
- Third parties or products categories.
|
||||
- LDAP connectivity.
|
||||
- ClickToDial integration.
|
||||
- RSS integration.
|
||||
- Can be extended with a lot of other external modules available onto DoliStore.com.
|
||||
|
||||
### Extending
|
||||
### Miscellaneous:
|
||||
|
||||
Dolibarr can be extended with a lot of other external modules from third party developers available at the [DoliStore](http://www.dolistore.com).
|
||||
- Multi-user, with several permissions levels for each feature.
|
||||
- Very user friendly and easy to use.
|
||||
- Highly customizable: Enable only modules you need, user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one).
|
||||
- Works with PHP 5.3+, MySql 4.1 or PostgreSQL 8.1.
|
||||
- Require PHP and Mysql or Postgresql (See exatc versions on http://wiki.dolibarr.org/index.php/Prerequisite).
|
||||
- Compatible with all Cloud solutions that match MySql, PHP or PostgreSQL prerequisites.
|
||||
- An easy to understand, maintain and code interfaces with your own system information (PHP with no heavy frameworks, trigger and hook architecture).
|
||||
- Support countries specific features:
|
||||
Spanish Tax RE and ISPF.
|
||||
French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM).
|
||||
Canadian double taxes (federal/province) and other countries using cumulative VAT.
|
||||
Tunisian tax stamp.
|
||||
Compatible with European directives (2006/112/CE ... 2010/45/UE) (http://europa.eu/legislation_summaries/taxation/l31057_en.htm)
|
||||
...
|
||||
|
||||
## FUTURE
|
||||
|
||||
These are features that Dolibarr does **not** yet fully support:
|
||||
## WHAT DOLIBARR CAN'T DO YET (TODO LIST)
|
||||
|
||||
- Double-entry bookkeeping (only bank and treasury management)
|
||||
- Multiple currencies
|
||||
- Multiple companies
|
||||
If you want to manage several companies or foundations, you must install the software several times (on same server or not) or use the MultiCompany addon module that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas)
|
||||
- Tasks dependencies in projects
|
||||
- Payroll module
|
||||
- Webmail
|
||||
- Dolibarr can't do coffee (yet)
|
||||
This is features that Dolibarr does not support completely yet:
|
||||
|
||||
## DOCUMENTATION
|
||||
- No double party accountancy (only bank and treasury management).
|
||||
- Dolibarr manage one currency at once (mono-currency).
|
||||
- Dolibarr manage one master activity (mono-company). If you want to manage several companies or foundations, you must install several time the software (on same server or not). Another solution is to extend Dolibarr with the addon Module MultiCompany that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas).
|
||||
- Tasks on module project can't have dependencies between each other.
|
||||
- Dolibarr does not contains Payroll module.
|
||||
- Dolibarr does not include any Webmail.
|
||||
- Dolibarr can't do coffee (not yet).
|
||||
|
||||
Administrator, user, developer and translator's documentations are available along with other community resources on the [Wiki](http://wiki.dolibarr.org).
|
||||
|
||||
## CREDITS
|
||||
|
||||
Dolibarr is the work of many contributors over the years and uses some fine libraries.
|
||||
|
||||
See [COPYRIGHT](COPYRIGHT) file.
|
||||
|
||||
## SOCIAL NETWORKS
|
||||
|
||||
Follow Dolibarr project on:
|
||||
Follow Dolibarr project on
|
||||
|
||||
Facebook: <https://www.facebook.com/dolibarr>
|
||||
|
||||
Google+: <https://plus.google.com/+DolibarrOrg>
|
||||
|
||||
Twitter: <http://www.twitter.com/dolibarr>
|
||||
|
||||
- [Facebook](https://www.facebook.com/dolibarr)
|
||||
- [Google+](https://plus.google.com/+DolibarrOrg)
|
||||
- [Twitter](http://www.twitter.com/dolibarr)
|
||||
- [LinkedIn](https://www.linkedin.com/company/association-dolibarr)
|
||||
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
|
||||
- [GitHub](https://github.com/Dolibarr/dolibarr)
|
||||
|
||||
@@ -38,15 +38,6 @@ filter-pristine-tar = True
|
||||
END
|
||||
|
||||
|
||||
# Complete .bashrc with DEBEMAIL and DEBFULLNAME
|
||||
Example:
|
||||
export DEBFULLNAME="Laurent Destailleur (eldy)"
|
||||
export DEBEMAIL=eldy@users.sourceforge.net
|
||||
Other example:
|
||||
export DEBFULLNAME="Laurent Destailleur"
|
||||
export DEBEMAIL="eldy@destailleur.fr"
|
||||
|
||||
|
||||
# To use Alioth.debian.org
|
||||
* Create an account login
|
||||
* Update your ~/.ssh/config file to add:
|
||||
@@ -110,38 +101,14 @@ http://packages.qa.debian.org/package.html
|
||||
http://bugs.debian.org/package
|
||||
|
||||
|
||||
##### Modify severity of a bug ticket
|
||||
|
||||
- Send this email to control@bugs.debian.org and wait 10 minutes
|
||||
|
||||
severity 123 xxx
|
||||
|
||||
|
||||
##### Update bug tracker system
|
||||
|
||||
To set status of a bug to "pending"
|
||||
> bts --smtp-host=yoursmtpserver tag 999999 +pending
|
||||
|
||||
or replay to email 999999@bugs.debian.org + submitter of bug
|
||||
With a message starting with:
|
||||
|
||||
Control: tag -1 +pending
|
||||
Thanks. Fixed into git.
|
||||
|
||||
or replay to email control@bugs.debian.org
|
||||
With only message
|
||||
tag 729538 +pending
|
||||
|
||||
|
||||
|
||||
##### Testing a package into unstable env
|
||||
|
||||
Check you have a mysql server available from another interface than "localhost".
|
||||
Check you have a mysql server available from another interface than localhost
|
||||
Comment line in /etc/mysql/my.cnf if required and restart mysql
|
||||
#bind-address = 127.0.0.1
|
||||
|
||||
Create a chroot called "unstable-amd64-sbuild".
|
||||
Chroot env is stored into /srv/chroot directory.
|
||||
Create a chroot called "unstable-amd64-sbuild"
|
||||
> sudo sbuild-createchroot --keyring= unstable /srv/chroot/unstable http://ftp.uk.debian.org/debian
|
||||
|
||||
Pour lister les env chroot
|
||||
@@ -149,7 +116,6 @@ Pour lister les env chroot
|
||||
|
||||
Puis pour se connecter et préparer l'environnement
|
||||
> schroot -c name_of_chroot
|
||||
> cat /etc/debian_chroot to check which debian branch we are into
|
||||
> vi /usr/sbin/policy-rc.d and replace return code 101 (not allowed) into 0 (ok)
|
||||
> apt-get install links mysql-client
|
||||
|
||||
@@ -163,10 +129,7 @@ Pour tester un package
|
||||
> dpkg -i dolibarr*.deb ou pour avoir des traces: dpkg -D77777 -i dolibarr*.deb
|
||||
> apt-get install -f
|
||||
|
||||
If there is a problem launching apache, because port is already used, change it into your chroot install with
|
||||
> vi /etc/apache2/ports.conf
|
||||
Then restart.
|
||||
Then you can call/test dolibarr with http://localhost:port/dolibarr/ (It can be also called from host).
|
||||
Puis http://localhost/dolibarr/ (cela peut etre appeler depuis le hote).
|
||||
|
||||
|
||||
|
||||
@@ -195,7 +158,7 @@ If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VER
|
||||
* Some files are removed from archive by the get-orig-source.sh
|
||||
|
||||
* Staying into git root directory, run
|
||||
> git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz --debian-branch=[master|jessie] --upstream-branch=[upstream|upstream-3.5.x]
|
||||
> git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz
|
||||
|
||||
Note: If there was errors solved manually, you may need to make a git commit
|
||||
|
||||
@@ -208,15 +171,11 @@ Warning: Date must have format reported by "date -R"
|
||||
Warning: Name and email must match value into debian/control file (Entry added here is used by next step).
|
||||
|
||||
* We try to build package
|
||||
> rm -fr ../build-area;
|
||||
> git-buildpackage -us -uc --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
> rm -fr ../build-area; git-buildpackage -us -uc
|
||||
|
||||
Note: To build an old version, do: git checkout oldtagname -b newbranchname; git-buildpackage -us -uc --git-debian-branch=newbranchname --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match
|
||||
Note: Package is built into directory ../build-area
|
||||
Note: To compare 2 packages: debdiff package1.dsc package2.dsc
|
||||
|
||||
|
||||
* If package .deb is ok:
|
||||
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
|
||||
@@ -224,7 +183,7 @@ Note: If there was errors managed manually, you may need to make a git commit bu
|
||||
|
||||
* If ok, you can tag.
|
||||
> Edit debian/changelog to replace "UNRELEASED" into "unstable", then push
|
||||
> git-buildpackage --git-tag-only --git-retag --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
> git-buildpackage --git-tag-only --git-retag
|
||||
> git push --tags
|
||||
|
||||
* Compilation is then done by a debian developer and sent
|
||||
@@ -237,9 +196,26 @@ http://packages.qa.debian.org/t/tcpdf.html
|
||||
* Package will be into release when test will be moved as stable.
|
||||
|
||||
|
||||
|
||||
##### Update but tracker system
|
||||
To set status of a bug to pending
|
||||
> bts tag 999999 +pending
|
||||
|
||||
or replay to email 999999@bugs.debian.org + submitter of bug
|
||||
With a message starting with:
|
||||
Control: tag -1 +pending
|
||||
and then a text like:
|
||||
Thanks. Fixed into git.
|
||||
|
||||
or replay to email control@bugs.debian.org
|
||||
With only message
|
||||
tag 729538 +pending
|
||||
|
||||
|
||||
|
||||
##### Create/Maintain dolibarr package
|
||||
|
||||
To update dolibarr debian package when upstream version has changed
|
||||
To update dolibarr debian package
|
||||
|
||||
* You can git clone debian git repo
|
||||
> git clone git.debian.org:/git/collab-maint/dolibarr.git [dolibarr-debian]
|
||||
@@ -253,7 +229,7 @@ from git clone dir and make link to git.
|
||||
* If local branch upstream and pristine-tar does not exists, create it
|
||||
from origin/upstream and origin/pristine.
|
||||
|
||||
* When new upstream is available onto sourceforge, launch:
|
||||
* If new upstream is available onto sourceforge, launch:
|
||||
> debian/get-orig-source.sh
|
||||
If script fails with error Bad certificate, you can set "export PERL_LWP_SSL_VERIFY_HOSTNAME=0" to solve this.
|
||||
|
||||
@@ -267,53 +243,39 @@ dolibarr-x.y.z+dfsgw.tgz
|
||||
(x.y.z = version, w start from 1 and is increased for each new git-import-orig already done)
|
||||
|
||||
* Staying into git root directory, run
|
||||
> git-import-orig -vv ../dolibarr-x.y.z+dfsgw.tgz --debian-branch=[master|jessie] --upstream-branch=[upstream|upstream-3.5.x]
|
||||
> git-import-orig -vv ../dolibarr-x.y.z+dfsgw.tgz
|
||||
and enter version when requested with format
|
||||
x.y.z+dfsgw
|
||||
(x.y.z = version, w start from 1 and is increased for each new import)
|
||||
|
||||
Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit
|
||||
|
||||
* Fix debian/* files used to build package.
|
||||
Add an entry into debian/changelog
|
||||
> dch -v x.y.z+dfsgw-v "My comment" will add entry.
|
||||
For example: dch -v x.y.z+dfsgw-1 "New upstream release." for a new version (x.y.z = version, w start from 1 and increased for each new import)
|
||||
Then check/modify changelog to replace "version" or "unstable" with "UNRELEASED".
|
||||
* Add an entry into debian/changelog
|
||||
> dch -v x.y.z+dfsg-w "My comment" will add entry.
|
||||
For example: dch -v x.y.z+dfsgw-1 "New upstream release." for a new version (x.y.z = version, w start from 1 and increaed for each new import)
|
||||
Then modify changelog to replace "version" or "unstable" with "UNRELEASED".
|
||||
Then check/modify also the user/date signature:
|
||||
- Date must have format reported by "date -R"
|
||||
- Name and email must match value into debian/control file (Entry added here is used by next step).
|
||||
|
||||
* We try to build package
|
||||
> rm -fr ../build-area; git-buildpackage -us -uc
|
||||
|
||||
To update dolibarr debian package when only files into debian has changed
|
||||
|
||||
* Change files and commit.
|
||||
* Add a tag debian/x.y.z+dfsgw-2 (increase the last 1 into 2)
|
||||
|
||||
|
||||
Once files has been prepared, it's time to test:
|
||||
|
||||
* Try to build package
|
||||
> rm -fr ../build-area;
|
||||
> git-buildpackage -us -uc --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
|
||||
Note: To build an old version, do: git checkout oldtagname -b newbranchname; git-buildpackage -us -uc --git-debian-branch=newbranchname --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
|
||||
Note: You can use git-buildpackage -us -uc -d if you want to test build when dependencies does not match
|
||||
Note: Package is built into directory ../build-area
|
||||
Note: To compare 2 packages: debdiff package1.dsc package2.dsc
|
||||
|
||||
* Test package (see dedicated chapter to test it with debian unstable env)
|
||||
|
||||
* If package .deb is ok:
|
||||
Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit
|
||||
> git push --all
|
||||
> git push --all ou git push origin --all
|
||||
|
||||
* If ok, you can tag.
|
||||
> Edit debian/changelog to replace "UNRELEASED" into "unstable", then push
|
||||
> git-buildpackage --git-tag-only --git-retag --git-debian-branch=[master|jessie] --git-upstream-branch=[upstream|upstream-3.5.x]
|
||||
> git-buildpackage --git-tag-only --git-retag
|
||||
> git push --tags
|
||||
|
||||
|
||||
* Compilation is then done by a debian developer and sent
|
||||
> sbuild ...
|
||||
> dput ...
|
||||
@@ -326,34 +288,3 @@ http://packages.qa.debian.org
|
||||
|
||||
* Package will be into release when test will be moved as stable.
|
||||
|
||||
|
||||
##### Send an unblock request
|
||||
|
||||
Use this to move from unstable to testing.
|
||||
|
||||
reportbug -B debian
|
||||
Choose package "release.debian.org"
|
||||
Then "unblock"
|
||||
Then name of package "dolibarr"
|
||||
Fill message, for example:
|
||||
"Please unblock package dolibarr
|
||||
A security error CVE-2015-3935 was reported and is fixed into package 3.5.7.
|
||||
Note that package 3.5.7 contains not only fixed for bugs reported to debian. It includes other fixes, but they are all related to stability or security,
|
||||
so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935.
|
||||
After discussion with ..., it appears that security holes are enough to request this unblock request."
|
||||
|
||||
|
||||
Use this to request an update of a stable package
|
||||
|
||||
reportbug -B debian
|
||||
Choose package "release.debian.org"
|
||||
Then "unblock"
|
||||
Then name of package "dolibarr"
|
||||
Fill message, for example:
|
||||
"Please unblock package dolibarr
|
||||
A security error CVE-2015-3935 was reported and is fixed into package 3.5.7.
|
||||
Note that package 3.5.7 contains not only fixed for bugs reported to debian. It includes other fixes, but they are all related to stability or security,
|
||||
so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935.
|
||||
After discussion with ..., it appears that security holes are enough to request this unblock request."
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
dolibarr (__VERSION__) UNRELEASED; urgency=low
|
||||
dolibarr (3.7.2-3) UNRELEASED; urgency=low
|
||||
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
@@ -40,28 +40,10 @@ enable_install_upgrade_wizard() {
|
||||
rm -f /var/lib/dolibarr/documents/install.lock
|
||||
}
|
||||
|
||||
|
||||
php_install() {
|
||||
if which php5enmod >/dev/null 2>&1 ;then
|
||||
# php5endmod exists for ubuntu only
|
||||
echo "Enable php module mysqli with php5enmod"
|
||||
php5enmod mysqli
|
||||
fi
|
||||
}
|
||||
|
||||
apache_install() {
|
||||
webserver=$1
|
||||
|
||||
# Enable Apache 2 alias module
|
||||
if which a2enmod >/dev/null 2>&1 ;then
|
||||
echo "Enable apache module alias with a2enmod"
|
||||
a2enmod alias
|
||||
fi
|
||||
|
||||
# Enable dolibarr conf
|
||||
if which a2enconf >/dev/null 2>&1 ;then
|
||||
# a2enconf exists for ubuntu only
|
||||
echo "Enable link for Apache config file with a3enconf"
|
||||
a2enconf dolibarr
|
||||
else
|
||||
if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then
|
||||
@@ -106,7 +88,11 @@ case "$1" in
|
||||
echo This is not a first install
|
||||
fi
|
||||
|
||||
php_install
|
||||
# Apache 2 setup
|
||||
if which a2enmod >/dev/null 2>&1 ;then
|
||||
a2enmod alias
|
||||
fi
|
||||
|
||||
apache_install
|
||||
lighttpd_install
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ for <a href="http://www.dolibarr.org">$projectname</a> by Doxygen $doxygenversio
|
||||
|
||||
|
||||
<!-- Google AdSense -->
|
||||
<div class="center">
|
||||
<center>
|
||||
<script type="text/javascript"><!--
|
||||
google_ad_client = "pub-1071905880519467";
|
||||
/* PUBBANDEAUDOLIBARR */
|
||||
@@ -36,7 +36,7 @@ google_ad_height = 60;
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
|
||||
</div>
|
||||
</center>
|
||||
<!-- End google adsense -->
|
||||
<br>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ File added into doxygen generated documentation
|
||||
</div>
|
||||
|
||||
<div id="logodol">
|
||||
<div class="center">
|
||||
<center>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td><div id="projectname">$projectname</div> - <span id="projectnumber">$projectnumber</span></td>
|
||||
@@ -54,7 +54,7 @@ File added into doxygen generated documentation
|
||||
<!-- banner end --></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</center>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ help=!(Port > 0);
|
||||
Usage:
|
||||
if (help) {
|
||||
printf("----- %s V%s (c)Laurent Destailleur -----\n",PROG,VERSION);
|
||||
printf("%s is software that allows you to know if a TCP/IP port is used\n",PROG);
|
||||
printf("%s is a software that allows you to know if a TCP/IP port is used\n",PROG);
|
||||
printf("%s sources can be compiled for WIN32 (VC++, GCC CYGWIN, MINGW) or for\n");
|
||||
printf("Unix/Linux (GCC)\n",PROG);
|
||||
printf("\n");
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 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 build/generate_filecheck_xml.php
|
||||
* \ingroup dev
|
||||
* \brief This script create a xml checksum file
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
// Main
|
||||
parse_str($argv[1]);
|
||||
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
|
||||
$outputfile=dirname(__FILE__).'/../htdocs/install/filelist.xml';
|
||||
$fp = fopen($outputfile,'w');
|
||||
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
|
||||
fputs($fp, '<checksum_list version="'.$release.'">'."\n");
|
||||
|
||||
fputs($fp, '<dolibarr_htdocs_dir>'."\n");
|
||||
|
||||
$dir_iterator1 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../htdocs/');
|
||||
$iterator1 = new RecursiveIteratorIterator($dir_iterator1);
|
||||
// need to ignore document custom etc
|
||||
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install|nltechno))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
foreach ($files as $file) {
|
||||
$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
|
||||
if ($newdir!=$dir) {
|
||||
if ($needtoclose)
|
||||
fputs($fp, '</dir>'."\n");
|
||||
fputs($fp, '<dir name="'.$newdir.'" >'."\n");
|
||||
$dir = $newdir;
|
||||
$needtoclose=1;
|
||||
}
|
||||
if (filetype($file)=="file") {
|
||||
fputs($fp, '<md5file name="'.basename($file).'">'.md5_file($file).'</md5file>'."\n");
|
||||
}
|
||||
}
|
||||
fputs($fp, '</dir>'."\n");
|
||||
fputs($fp, '</dolibarr_htdocs_dir>'."\n");
|
||||
|
||||
|
||||
fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n");
|
||||
|
||||
$dir_iterator2 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../scripts/');
|
||||
$iterator2 = new RecursiveIteratorIterator($dir_iterator2);
|
||||
// need to ignore document custom etc
|
||||
$files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install|nltechno))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
|
||||
$dir='';
|
||||
$needtoclose=0;
|
||||
foreach ($files as $file) {
|
||||
$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
|
||||
if ($newdir!=$dir) {
|
||||
if ($needtoclose)
|
||||
fputs($fp, '</dir>'."\n");
|
||||
fputs($fp, '<dir name="'.$newdir.'" >'."\n");
|
||||
$dir = $newdir;
|
||||
$needtoclose=1;
|
||||
}
|
||||
if (filetype($file)=="file") {
|
||||
fputs($fp, '<md5file name="'.basename($file).'">'.md5_file($file).'</md5file>'."\n");
|
||||
}
|
||||
}
|
||||
fputs($fp, '</dir>'."\n");
|
||||
fputs($fp, '</dolibarr_script_dir>'."\n");
|
||||
|
||||
|
||||
fputs($fp, '</checksum_list>'."\n");
|
||||
fclose($fp);
|
||||
|
||||
print "File ".$outputfile." generated\n";
|
||||
|
||||
exit(0);
|
||||
@@ -41,21 +41,23 @@ If you want to build/test package locally:
|
||||
# Push/declare Dolibarr sources to Launchpad
|
||||
#----------------------------------
|
||||
- From Launchpad project (https://launchpad.net/dolibarr), register a series:
|
||||
Call it 'trunk' or 'stable'
|
||||
Call it 'trunk' or 'beta' or 'stable'
|
||||
Use branch (dev):
|
||||
https://launchpad.net/~eldy/dolibarr/develop
|
||||
https://launchpad.net/~eldy/dolibarr/stable
|
||||
~eldy/dolibarr/develop
|
||||
~eldy/dolibarr/beta
|
||||
~eldy/dolibarr/stable
|
||||
or
|
||||
Use URL pattern (stable):
|
||||
Use URL pattern (beta or stable):
|
||||
For stable: http://www.dolibarr.org/files/lastbuild/package_debian-ubuntu/dolibarr_x.z.*.tar.gz
|
||||
For beta: 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 stable, you can init from command line
|
||||
cd bzr/dolibarr-stable
|
||||
- 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]
|
||||
|
||||
- List of series are visible here: https://launchpad.net/dolibarr/+series
|
||||
|
||||
@@ -63,19 +65,19 @@ If you want to build/test package locally:
|
||||
#----------------------------------
|
||||
# create local repository
|
||||
cd bzr
|
||||
bzr branch lp:~yourlogin/dolibarr/[develop|stable] dolibarr-[dev|stable]
|
||||
cd dolibarr-[dev|stable]
|
||||
bzr branch lp:~yourlogin/dolibarr/[develop|beta|stable] dolibarr-[dev|beta|stable]
|
||||
cd dolibarr-[dev|beta|stable]
|
||||
# Update
|
||||
bzr update
|
||||
-- Update files here: Remove all (except .bzr dir) and overwrite --
|
||||
-- Update files here. Remove all and overwrite --
|
||||
bzr status
|
||||
bzr add *
|
||||
bzr commit -m "Upstream version x.y"
|
||||
bzr commit -m "Description of change"
|
||||
bzr push
|
||||
|
||||
# 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|stable]
|
||||
- Create debian directory and upload it onto bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
cd bzr
|
||||
mkdir debian
|
||||
cd debian
|
||||
@@ -83,25 +85,25 @@ 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 just bzr push if into a known branch)
|
||||
bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable] (put here any branch name or just bzr push if into a known branch)
|
||||
- or download it from launchpad bazaar:
|
||||
cd bzr
|
||||
bzr branch lp:~yourlogin/+junk/debian-[dev|stable]
|
||||
bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
|
||||
# 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|stable]
|
||||
cd debian-[dev|stable]
|
||||
bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
cd debian-[dev|beta|stable]
|
||||
bzr status
|
||||
-- Update files here: Remove all (except .bzr dir) and overwrite. Restore version into the file changelog --
|
||||
-- Update files here --
|
||||
bzr commit -m "Description of change"
|
||||
bzr push lp:~yourlogin/+junk/debian-[dev|stable]
|
||||
bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
|
||||
|
||||
# Define a recipe into launchpad (a rule to build packages into a PPA)
|
||||
@@ -113,6 +115,10 @@ If you want to build/test package locally:
|
||||
# bzr-builder format 0.3 deb-version {debupstream}-0~{revno}
|
||||
lp:dolibarr
|
||||
merge packaging lp:~yourlogin/+junk/debian-dev
|
||||
For beta:
|
||||
# bzr-builder format 0.3 deb-version {debupstream}-1~{revno}
|
||||
lp:dolibarr/beta
|
||||
merge packaging lp:~yourlogin/+junk/debian-beta
|
||||
For stable:
|
||||
# bzr-builder format 0.3 deb-version {debupstream}-2~{revno}
|
||||
lp:dolibarr/stable
|
||||
@@ -120,12 +126,13 @@ If you want to build/test package locally:
|
||||
- Run command
|
||||
cd bzr
|
||||
bzr dailydeb dolibarr.recipe working-dir
|
||||
This will create a directory "working-dir" with dolibarr sources and will add sources from ~yourlogin/+junk/debian-[dev|stable]
|
||||
This will create a directory "working-dir" with dolibarr sources and will add sources from ~yourlogin/+junk/debian-[dev|beta|stable]
|
||||
- Test package sources
|
||||
sudo pbuilder build <working-dir>/<project>_<version>.dsc
|
||||
|
||||
List of recipes created
|
||||
https://code.launchpad.net/~eldy/+recipe/dolibarr-dev
|
||||
https://code.launchpad.net/~eldy/+recipe/dolibarr-beta
|
||||
https://code.launchpad.net/~eldy/+recipe/dolibarr-stable
|
||||
|
||||
|
||||
@@ -140,6 +147,9 @@ https://code.launchpad.net/~eldy/+recipe/dolibarr-stable
|
||||
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
|
||||
For the beta version:
|
||||
deb http://ppa.launchpad.net/yourlogin/dolibarr-beta/ubuntu precise main
|
||||
deb-src http://ppa.launchpad.net/yourlogin/dolibarr-beta/ubuntu precise main
|
||||
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
|
||||
|
||||
@@ -64,13 +64,6 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
|
||||
|
||||
$SOURCE="$DIR/..";
|
||||
$DESTI="$SOURCE/build";
|
||||
if ($SOURCE !~ /^\//)
|
||||
{
|
||||
print "Error: Launch the script $PROG.$Extension with its full path from /.\n";
|
||||
print "$PROG.$Extension aborted.\n";
|
||||
sleep 2;
|
||||
exit 1;
|
||||
}
|
||||
if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"})
|
||||
{
|
||||
print "Error: Missing environment variables.\n";
|
||||
@@ -344,8 +337,8 @@ foreach my $target (sort keys %CHOOSEDPUBLISH) {
|
||||
|
||||
if ($nboftargetok) {
|
||||
|
||||
# Update GIT tag if required
|
||||
#---------------------------
|
||||
# Update CVS if required
|
||||
#-----------------------
|
||||
if ($nbofpublishneedtag)
|
||||
{
|
||||
print "Go to directory $SOURCE\n";
|
||||
@@ -427,7 +420,6 @@ if ($nboftargetok) {
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/install/mssql`;
|
||||
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ansible`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codesniffer`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/codetemplates`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/dbmodel`;
|
||||
@@ -436,7 +428,6 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/ldap`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/licence`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/multitail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpcheckstyle`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/phpunit`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/dev/security`;
|
||||
@@ -464,28 +455,25 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
|
||||
|
||||
# Removed known external modules to avoid any error when packaging from env where external modules are tested
|
||||
# Removed known external modules to avoir any error when packaging on test env
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom/*`; # For custom we want to keep dir
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/calling*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/lead*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ndf*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
|
||||
# Removed other test files
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/eldy/*.new`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/api/explorer`; # This is a dev tool
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
|
||||
@@ -502,7 +490,6 @@ if ($nboftargetok) {
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PCLZip`;
|
||||
@@ -694,7 +681,7 @@ if ($nboftargetok) {
|
||||
use Date::Language;
|
||||
$lang=Date::Language->new('English');
|
||||
$datestring = $lang->time2str("%a %b %e %Y", time);
|
||||
$changelogstring="* ".$datestring." Laurent Destailleur (eldy) $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n- Upstream release\n";
|
||||
$changelogstring="* ".$datestring." Laurent Destailleur $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n- Upstream release\n";
|
||||
|
||||
print "Generate file $BUILDROOT/$BUILDFIC from $SOURCE/build/rpm/${BUILDFICSRC}\n";
|
||||
open (SPECFROM,"<$SOURCE/build/rpm/${BUILDFICSRC}") || die "Error";
|
||||
@@ -726,7 +713,7 @@ if ($nboftargetok) {
|
||||
$ret=`$cmd`;
|
||||
print "Move $RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz into $NEWDESTI/".$FILENAMETGZ2.".tgz\n";
|
||||
$cmd="mv \"$RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz\" \"$NEWDESTI/".$FILENAMETGZ2.".tgz\"";
|
||||
#$ret=`$cmd`;
|
||||
$ret=`$cmd`;
|
||||
next;
|
||||
}
|
||||
|
||||
@@ -816,17 +803,8 @@ if ($nboftargetok) {
|
||||
print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n";
|
||||
$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n";
|
||||
# Add files for dpkg-source (changelog)
|
||||
#$ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
open (SPECFROM,"<$SOURCE/build/debian/changelog") || die "Error";
|
||||
open (SPECTO,">$BUILDROOT/$PROJECT.tmp/debian/changelog") || die "Error";
|
||||
while (<SPECFROM>) {
|
||||
$_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/;
|
||||
print SPECTO $_;
|
||||
}
|
||||
close SPECFROM;
|
||||
close SPECTO;
|
||||
# Add files for dpkg-source
|
||||
$ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/compat" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
|
||||
@@ -8,16 +8,15 @@ This files describe steps made by Dolibarr packaging team to make a
|
||||
beta version of Dolibarr, step by step.
|
||||
|
||||
- Check all files are commited.
|
||||
- Update version/info in ChangeLog.
|
||||
To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x-1.y-1.0 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
|
||||
To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x.y.z-1 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
|
||||
- Update version/info in ChangeLog. To generate a changelog, you can do "git log x.y.z..HEAD --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIXED\|NEW'"
|
||||
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
|
||||
- Update version number with x.y.z-w in build/debian/changelog
|
||||
- Commit all changes.
|
||||
- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
|
||||
- Create a branch (x.y).
|
||||
|
||||
- Run makepack-dolibarr.pl to generate all packages.
|
||||
|
||||
- Create a branch (x.y), if version seems stable enough.
|
||||
|
||||
- Move build files into www.dolibarr.org web site
|
||||
(/home/dolibarr/wwwroot/files/lastbuild).
|
||||
|
||||
@@ -30,10 +29,9 @@ 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.
|
||||
To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x-1.y-1.0 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
|
||||
To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x.y.z-1 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
|
||||
- Update version/info in ChangeLog. To generate a changelog, you can do "git log x.y.z..HEAD --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^Fix\|New\|Sec'"
|
||||
- Update version number with x.y.z in htdocs/filefunc.inc.php
|
||||
- Update version number with x.y.z in build/debian/changelog
|
||||
- Commit all changes.
|
||||
|
||||
- Run makepack-dolibarr.pl to generate all packages.
|
||||
|
||||
@@ -14,7 +14,7 @@ https://build.opensuse.org
|
||||
Packaging rules: http://en.opensuse.org/Portal:Packaging
|
||||
|
||||
Add attributes:
|
||||
OBS:Screenshots URL of screenshot http://www.dolibarr.org/images/dolibarr_screenshot1.png
|
||||
OBS:Screenshots URL of screenshot
|
||||
OBS:QualityCategory Development|Testing|Stable|Private
|
||||
OBS:Maintained 1
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM for Windows</Char_Desc_45>
|
||||
<Char_Desc_80>DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation</Char_Desc_80>
|
||||
<Char_Desc_250>DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs.</Char_Desc_250>
|
||||
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
|
||||
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
|
||||
<Char_Desc_2000>DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop.
|
||||
|
||||
DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file.</Char_Desc_2000>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM for Windows</Char_Desc_45>
|
||||
<Char_Desc_80>DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation</Char_Desc_80>
|
||||
<Char_Desc_250>DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs.</Char_Desc_250>
|
||||
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
|
||||
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
|
||||
<Char_Desc_2000>DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop.
|
||||
|
||||
DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file.</Char_Desc_2000>
|
||||
|
||||
@@ -259,7 +259,7 @@ if ($upgrade) {
|
||||
[ "versionfrom", $upgrade->{'version'} ],
|
||||
[ "versionto", $ver ],
|
||||
);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Remove the installation directory.
|
||||
@@ -285,12 +285,12 @@ else {
|
||||
[ "usealternaterootdir", "1" ],
|
||||
[ "main_alt_dir_name", "custom" ],
|
||||
);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, "step1", $d, $opts);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, "etape1", $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Second page (Populate database)
|
||||
local @params = ( [ "action", "set" ] );
|
||||
local $err = &call_dolibarr_wizard_page(\@params, "step2", $d, $opts);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, "etape2", $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Third page (Add administrator account)
|
||||
@@ -299,7 +299,7 @@ else {
|
||||
[ "pass", $dompass ],
|
||||
[ "pass_verif", $dompass ],
|
||||
);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
|
||||
local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts);
|
||||
return (-1, "Dolibarr wizard failed : $err") if ($err);
|
||||
|
||||
# Remove the installation directory and protect config file.
|
||||
|
||||
@@ -159,7 +159,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/accountancy
|
||||
%_datadir/dolibarr/htdocs/adherents
|
||||
%_datadir/dolibarr/htdocs/admin
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
@@ -173,10 +172,8 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/contrat
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
@@ -188,13 +185,12 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
%_datadir/dolibarr/htdocs/printing
|
||||
%_datadir/dolibarr/htdocs/printipp
|
||||
%_datadir/dolibarr/htdocs/product
|
||||
%_datadir/dolibarr/htdocs/projet
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
|
||||
@@ -239,7 +239,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/accountancy
|
||||
%_datadir/dolibarr/htdocs/adherents
|
||||
%_datadir/dolibarr/htdocs/admin
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
@@ -253,10 +252,8 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/contrat
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
@@ -268,13 +265,12 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
%_datadir/dolibarr/htdocs/printing
|
||||
%_datadir/dolibarr/htdocs/printipp
|
||||
%_datadir/dolibarr/htdocs/product
|
||||
%_datadir/dolibarr/htdocs/projet
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
|
||||
@@ -156,7 +156,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/accountancy
|
||||
%_datadir/dolibarr/htdocs/adherents
|
||||
%_datadir/dolibarr/htdocs/admin
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
@@ -170,10 +169,8 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/contrat
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
@@ -185,13 +182,12 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
%_datadir/dolibarr/htdocs/printing
|
||||
%_datadir/dolibarr/htdocs/printipp
|
||||
%_datadir/dolibarr/htdocs/product
|
||||
%_datadir/dolibarr/htdocs/projet
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
|
||||
@@ -167,7 +167,6 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/accountancy
|
||||
%_datadir/dolibarr/htdocs/adherents
|
||||
%_datadir/dolibarr/htdocs/admin
|
||||
%_datadir/dolibarr/htdocs/api
|
||||
%_datadir/dolibarr/htdocs/asterisk
|
||||
%_datadir/dolibarr/htdocs/barcode
|
||||
%_datadir/dolibarr/htdocs/bookmarks
|
||||
@@ -181,10 +180,8 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/contrat
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
@@ -196,13 +193,12 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/livraison
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
%_datadir/dolibarr/htdocs/margin
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
%_datadir/dolibarr/htdocs/printing
|
||||
%_datadir/dolibarr/htdocs/printipp
|
||||
%_datadir/dolibarr/htdocs/product
|
||||
%_datadir/dolibarr/htdocs/projet
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"ext-gd": "*",
|
||||
"ext-curl": "*",
|
||||
"restler/framework": "3.0.*"
|
||||
"ext-curl": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mysqli": "*",
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
README (English)
|
||||
--------------------------------
|
||||
|
||||
This directory contains ruleset files to use to develop Dolibarr EPR & CRM.
|
||||
This directory contains ruleset files to use to
|
||||
develop Dolibarr EPR & CRM with Eclipse.
|
||||
|
||||
To install/upgrade phpcs:
|
||||
> sudo pear upgrade PHP_CodeSniffer
|
||||
|
||||
Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with:
|
||||
Note: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with:
|
||||
* tab value to 4
|
||||
* path of code sniffer standard to dev/codesniffer
|
||||
|
||||
* path of code sniffer standard to dev/codesniffer
|
||||
@@ -173,44 +173,138 @@
|
||||
|
||||
|
||||
|
||||
<!-- Rules from PEAR Standard -->
|
||||
<!-- Rules from PEAR Standard -->
|
||||
|
||||
<rule ref="PEAR.Classes.ClassDeclaration" />
|
||||
<rule ref="PEAR.Classes.ClassDeclaration" />
|
||||
|
||||
<!-- Check for duplicate class names -->
|
||||
<!-- <rule ref="Generic.Classes.DuplicateClassName" /> -->
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment" />
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<!-- TODO Remove this and fix reported errors -->
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.Missing">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<!-- TODO Remove this and fix reported errors -->
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.Missing">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@authorTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@categoryTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@licenseTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@linkTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing@packageTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingTag" />
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingAuthorTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingCategoryTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingLicenseTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingLinkTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.ClassComment.MissingPackageTag">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<!-- TODO Remove this and fix reported errors -->
|
||||
<rule ref="PEAR.Commenting.ClassComment.Missing">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.Missing">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<rule ref="PEAR.Commenting.FileComment" />
|
||||
<rule ref="PEAR.Commenting.FileComment.WrongStyle">
|
||||
@@ -223,40 +317,15 @@
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
-->
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment" />
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.Empty">
|
||||
<severity>5</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.MissingReturn">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="PEAR.Commenting.FunctionComment.Missing">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType" />
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamType">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingAfterParamName" />
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.ReturnNotRequired">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.WrongStyle">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment.Empty">
|
||||
<severity>5</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.Commenting.FunctionComment" />
|
||||
<rule ref="PEAR.Commenting.FunctionComment.SpacingBeforeParamType">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
@@ -350,11 +419,6 @@
|
||||
</rule>
|
||||
<rule ref="PEAR.NamingConventions.ValidVariableName" />
|
||||
|
||||
<!-- This is not in PSR2 -->
|
||||
<rule ref="PEAR.NamingConventions.ValidVariableName.PrivateNoUnderscore">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent" />
|
||||
|
||||
<!-- Need to be commented to be disabled
|
||||
|
||||
@@ -23,21 +23,6 @@ Replace call to serialize_val with no bugged value
|
||||
|
||||
|
||||
|
||||
FPDI:
|
||||
-----
|
||||
Replace:
|
||||
$this->_readXref($this->_xref, $this->_findXref());
|
||||
with:
|
||||
try {
|
||||
$this->_readXref($this->_xref, $this->_findXref());
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
print $e->getMessage();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
TCPDF:
|
||||
------
|
||||
* Removed all fonts except
|
||||
@@ -62,19 +47,6 @@ In htdocs/includes/tcpdf/tcpdf.php
|
||||
* Renamed getmypid into dol_getmypid().
|
||||
|
||||
|
||||
TCPDI:
|
||||
------
|
||||
Add fpdf_tpl.php 1.2
|
||||
Add tcpdi.php
|
||||
Add tcpdi_parser.php and replace:
|
||||
require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
|
||||
with:
|
||||
require_once(dirname(__FILE__).'/../tcpdf/include/tcpdf_filters.php');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JSGANTT:
|
||||
--------
|
||||
* Replace in function JSGantt.taskLink
|
||||
|
||||
@@ -66,11 +66,11 @@ $myproduct=new Product($db);
|
||||
|
||||
// Definition of product instance properties
|
||||
$myproduct->ref = '1234';
|
||||
$myproduct->label = 'label';
|
||||
$myproduct->libelle = 'libelle';
|
||||
$myproduct->price = '10';
|
||||
$myproduct->price_base_type = 'HT';
|
||||
$myproduct->tva_tx = '19.6';
|
||||
$myproduct->type = Product::TYPE_PRODUCT;
|
||||
$myproduct->type = 0;
|
||||
$myproduct->status = 1;
|
||||
$myproduct->description = 'Description';
|
||||
$myproduct->note = 'Note';
|
||||
|
||||
@@ -73,7 +73,7 @@ $obj->socid=$argv[1];
|
||||
|
||||
$listofcontractsforcompany=$obj->getListOfContracts('all');
|
||||
|
||||
print $listofcontractsforcompany;
|
||||
print_r($listofcontractsforcompany);
|
||||
|
||||
|
||||
// -------------------- END OF YOUR CODE --------------------
|
||||
|
||||
@@ -10,21 +10,21 @@
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "This script detect or clean files with CR+LF into files with LF only. All source files are included, also files into includes."
|
||||
echo "Detect and fix files ending with bad ending chars (must be LF)"
|
||||
echo "Usage: fixdosfiles.sh [list|fix]"
|
||||
fi
|
||||
|
||||
# To detec
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
|
||||
find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" \) -exec file "{}" + | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
|
||||
fi
|
||||
|
||||
# To convert
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
for fic in `find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
for fic in `find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
do
|
||||
echo "Fix file $fic"
|
||||
dos2unix $fic
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
Example fo recurring event, 1 week, no end, exported by Google
|
||||
|
||||
# The recurring event were recorded every monday the 20150518. This is the Recurrence-id, but then
|
||||
# first occurence was moved on tuesday. So this record were added.
|
||||
BEGIN:VEVENT
|
||||
DTSTART;TZID=Europe/Paris:20150519T100000
|
||||
DTEND;TZID=Europe/Paris:20150519T110000
|
||||
DTSTAMP:20150517T175754Z
|
||||
UID:9026chuafli29ns5soshvckamc@google.com
|
||||
RECURRENCE-ID;TZID=Europe/Paris:20150518T100000
|
||||
CREATED:20150517T174404Z
|
||||
DESCRIPTION:
|
||||
LAST-MODIFIED:20150517T175008Z
|
||||
LOCATION:
|
||||
SEQUENCE:1
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:aaa
|
||||
TRANSP:OPAQUE
|
||||
END:VEVENT
|
||||
|
||||
# The recurring event were recorded every monday the 20150518.
|
||||
BEGIN:VEVENT
|
||||
DTSTART;TZID=Europe/Paris:20150518T100000
|
||||
DTEND;TZID=Europe/Paris:20150518T110000
|
||||
RRULE:FREQ=WEEKLY;BYDAY=MO
|
||||
DTSTAMP:20150517T175754Z
|
||||
UID:9026chuafli29ns5soshvckamc@google.com
|
||||
CREATED:20150517T174404Z
|
||||
DESCRIPTION:
|
||||
LAST-MODIFIED:20150517T174404Z
|
||||
LOCATION:
|
||||
SEQUENCE:0
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:aaa
|
||||
TRANSP:OPAQUE
|
||||
END:VEVENT
|
||||
|
||||
|
||||
|
||||
|
||||
Example fo recurring event, every 2 month, no end, exported by Google
|
||||
|
||||
BEGIN:VEVENT
|
||||
DTSTART;TZID=Europe/Paris:20150519T080000
|
||||
DTEND;TZID=Europe/Paris:20150519T090000
|
||||
RRULE:FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19
|
||||
DTSTAMP:20150517T175754Z
|
||||
UID:urkq3ih1mlaqeu4dbkpdh4i61s@google.com
|
||||
CREATED:20150517T175658Z
|
||||
DESCRIPTION:
|
||||
LAST-MODIFIED:20150517T175658Z
|
||||
LOCATION:
|
||||
SEQUENCE:0
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:bbbbb
|
||||
TRANSP:OPAQUE
|
||||
END:VEVENT
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/generate-commande.php
|
||||
* \file htdocs/dev/generate-commande.php
|
||||
* \brief Script de generation de donnees aleatoires pour les commandes
|
||||
*/
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/intdata/generate-facture.php
|
||||
* \file htdocs/dev/generate-facture.php
|
||||
* \brief Script de generation de donnees aleatoires pour les factures
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/generate-produit.php
|
||||
* \file htdocs/dev/generate-produit.php
|
||||
* \brief Script de generation de donnees aleatoires pour les produits
|
||||
*/
|
||||
|
||||
@@ -88,7 +88,7 @@ for ($s = 0 ; $s < GEN_NUMBER_PRODUIT ; $s++)
|
||||
$produit->type = rand(0,1);
|
||||
$produit->status = 1;
|
||||
$produit->ref = ($produit->type?'S':'P').time().$s;
|
||||
$produit->label = 'Label '.time().$s;
|
||||
$produit->libelle = 'Label '.time().$s;
|
||||
$produit->description = 'Description '.time().$s;
|
||||
$produit->price = rand(1,1000);
|
||||
$produit->tva_tx = "19.6";
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/generate-propale.php
|
||||
* \file htdocs/dev/generate-propale.php
|
||||
* \brief Script de generation de donnees aleatoires pour les propales
|
||||
*/
|
||||
|
||||
@@ -103,8 +103,7 @@ if ($resql)
|
||||
}
|
||||
}
|
||||
|
||||
$user->rights->propal->creer=1;
|
||||
$user->rights->propal->propal_advance->validate=1;
|
||||
$user->rights->propale->valider=1;
|
||||
|
||||
|
||||
if (! empty($conf->global->PROPALE_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/generate-societe.php
|
||||
* \brief Script de generation de donnees aleatoires pour les societes
|
||||
* \file htdocs/dev/generate-societe.php
|
||||
* \brief Script de generation de donnees aleatoires pour les societes
|
||||
*/
|
||||
|
||||
// Test si mode batch
|
||||
@@ -89,7 +89,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
|
||||
{
|
||||
print "Company $s\n";
|
||||
$soc = new Societe($db);
|
||||
$soc->name = "Company num ".time()."$s";
|
||||
$soc->nom = "Company num ".time()."$s";
|
||||
$soc->town = $listoftown[rand(0, count($listoftown)-1)];
|
||||
$soc->client = rand(1,2); // Une societe sur 2 est prospect, l'autre client
|
||||
$soc->fournisseur = rand(0,1); // Une societe sur 2 est fournisseur
|
||||
@@ -101,7 +101,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
|
||||
// Un client sur 3 a une remise de 5%
|
||||
$user_remise=rand(1,3); if ($user_remise==3) $soc->remise_percent=5;
|
||||
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
|
||||
$soc->note_private = 'Company created by the script generate-societe.php';
|
||||
$soc->note='Company created by the script generate-societe.php';
|
||||
$socid = $soc->create();
|
||||
|
||||
if ($socid >= 0)
|
||||
@@ -120,7 +120,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
|
||||
}
|
||||
}
|
||||
|
||||
print "Company ".$s." created nom=".$soc->name."\n";
|
||||
print "Company ".$s." created nom=".$soc->nom."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 102 KiB |
@@ -1,5 +1,4 @@
|
||||
# ldapadd_sample1.txt
|
||||
# ldapadd is into package ldap-utils on debian.
|
||||
#
|
||||
# Use this sample to add a dc "my-domain".
|
||||
# This is the first thing to create
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# ldapadd_sample2.txt
|
||||
# ldapadd is into package ldap-utils on debian.
|
||||
#
|
||||
# Use this sample to add a ou "contacts"
|
||||
# This is the second thing to create after creating the root my-domain
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# ldapadd_sample3.txt
|
||||
# ldapadd is into package ldap-utils on debian.
|
||||
#
|
||||
# Use this sample to add cn records
|
||||
# This is the step to create records inside tree ou=contacts,dc=my-domain,dc=com
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# ldapdelete_sample1.txt
|
||||
# ldapdelete is into package ldap-utils on debian.
|
||||
#
|
||||
# Use this sample to delete a dc "my-domain"
|
||||
# This delete the first level of LDAP tree.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# ldapdelete_sample3.txt
|
||||
# ldapdelete is into package ldap-utils on debian.
|
||||
#
|
||||
# Use this sample to delete cn records
|
||||
# This is the step to delete a cn record stored inside tree ou=contacts,dc=my-domain,dc=com
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# ldapmodify_sample1.txt
|
||||
# ldapmodify is into package ldap-utils on debian.
|
||||
#
|
||||
# Use this sample to modify a dc "my-domain"
|
||||
#
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# ldapsearch_sample1.txt
|
||||
# ldapsearch is into package ldap-utils on debian.
|
||||
#
|
||||
# Use this sample to search into a ldap
|
||||
#
|
||||
# ldapsearch -h hostname -x
|
||||
# ldapsearch -h hostname -x -b "ou=people,dc=teclib,dc=infra"
|
||||
# ldapsearch -h hostname -x -z 0 -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -W "(objectclass=*)"
|
||||
# ldapsearch -h hostname -x -b "o=somecompany.com" -D "cn=manager,o=somecompany.com" -W "(objectclass=*)"
|
||||
@@ -1,12 +0,0 @@
|
||||
# This is an example of multitail setup file you can use to analyze dolibarr log files.
|
||||
# Usage: multitail -cS dolibarr documents/dolibarr.log
|
||||
colorscheme:dolibarr
|
||||
bright:1
|
||||
cs_re:yellow,red:.*EMERG.*
|
||||
cs_re:white,red:.*ALERT.*
|
||||
cs_re:green,red:.*CRIT.*
|
||||
cs_re:red:.*ERR.*
|
||||
cs_re:white,yellow:.*WARNING.*
|
||||
cs_re:green,yellow:.*NOTICE.*
|
||||
cs_re:green:.*INFO.*
|
||||
cs_re:white:.*DEBUG.*
|
||||
@@ -6,7 +6,7 @@ PROGNAME=${0##*/}
|
||||
INPUT=''
|
||||
QUIET='0'
|
||||
NOSTATS='0'
|
||||
INPLACE='0' # (1=Images are replaced, 0=New images are stored into $OUTPUT)
|
||||
INPLACE='0'
|
||||
max_input_size=0
|
||||
max_output_size=0
|
||||
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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 dev/skeletons/build_api_class.php
|
||||
* \ingroup core
|
||||
* \brief Create a complete API class file from existant class file
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
|
||||
// Test if batch mode
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Include Dolibarr environment
|
||||
require_once($path."../../htdocs/master.inc.php");
|
||||
// After this $db is a defined handler to database.
|
||||
|
||||
// Main
|
||||
$version='1';
|
||||
@set_time_limit(0);
|
||||
$error=0;
|
||||
|
||||
$langs->load("main");
|
||||
|
||||
|
||||
print "***** $script_file ($version) *****\n";
|
||||
|
||||
|
||||
// -------------------- START OF BUILD_API_FROM_CLASS --------------------
|
||||
|
||||
// Check parameters
|
||||
if (! isset($argv[1]) && ! isset($argv[2]))
|
||||
{
|
||||
print "Usage: $script_file phpClassFile phpClassName\n";
|
||||
exit;
|
||||
}
|
||||
// Show parameters
|
||||
print 'Classfile='.$argv[1]."\n";
|
||||
print 'Classname='.$argv[2]."\n";
|
||||
|
||||
$classfile=$argv[1];
|
||||
$classname=$argv[2];
|
||||
$classmin=strtolower($classname);
|
||||
$classnameApi = $classname.'Api';
|
||||
$property=array();
|
||||
$targetcontent='';
|
||||
|
||||
// Load the class and read properties
|
||||
require_once($classfile);
|
||||
|
||||
$property=array();
|
||||
$class = new $classname($db);
|
||||
$values=get_class_vars($classname);
|
||||
|
||||
unset($values['db']);
|
||||
unset($values['error']);
|
||||
unset($values['errors']);
|
||||
unset($values['element']);
|
||||
unset($values['table_element']);
|
||||
unset($values['table_element_line']);
|
||||
unset($values['fk_element']);
|
||||
unset($values['ismultientitymanaged']);
|
||||
|
||||
// Read skeleton_api_class.class.php file
|
||||
$skeletonfile=$path.'skeleton_api_class.class.php';
|
||||
$sourcecontent=file_get_contents($skeletonfile);
|
||||
if (! $sourcecontent)
|
||||
{
|
||||
print "\n";
|
||||
print "Error: Failed to read skeleton sample '".$skeletonfile."'\n";
|
||||
print "Try to run script from skeletons directory.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define output variables
|
||||
$outfile='out.api_'.$classmin.'.class.php';
|
||||
$targetcontent=$sourcecontent;
|
||||
|
||||
// Substitute class name
|
||||
$targetcontent=preg_replace('/skeleton_api_class\.class\.php/', 'api_'.$classmin.'.class.php', $targetcontent);
|
||||
$targetcontent=preg_replace('/skeleton/', $classmin, $targetcontent);
|
||||
//$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$tablenoprefix.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/SkeletonApi/', $classnameApi, $targetcontent);
|
||||
$targetcontent=preg_replace('/Skeleton/', $classname, $targetcontent);
|
||||
|
||||
// Build file
|
||||
$fp=fopen($outfile,"w");
|
||||
if ($fp)
|
||||
{
|
||||
fputs($fp, $targetcontent);
|
||||
fclose($fp);
|
||||
print "\n";
|
||||
print "File '".$outfile."' has been built in current directory.\n";
|
||||
}
|
||||
else $error++;
|
||||
|
||||
|
||||
|
||||
// -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT --------------------
|
||||
|
||||
print "You can now rename generated files by removing the 'out.' prefix in their name and store them into directory /module/class.\n";
|
||||
return $error;
|
||||
@@ -50,16 +50,16 @@ print "***** $script_file ($version) *****\n";
|
||||
// -------------------- START OF BUILD_CLASS_FROM_TABLE SCRIPT --------------------
|
||||
|
||||
// Check parameters
|
||||
if (! isset($argv[1]) || ! isset($argv[2]) || (isset($argv[3]) && ! isset($argv[7])))
|
||||
if (! isset($argv[1]) || (isset($argv[2]) && ! isset($argv[6])))
|
||||
{
|
||||
print "Usage: $script_file tablename modulename [server port databasename user pass]\n";
|
||||
print "Usage: $script_file tablename [server port databasename user pass]\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($argv[3]) && isset($argv[4]) && isset($argv[5]) && isset($argv[6]) && isset($argv[7]))
|
||||
if (isset($argv[2]) && isset($argv[3]) && isset($argv[4]) && isset($argv[5]) && isset($argv[6]))
|
||||
{
|
||||
print 'Use specific database ids'."\n";
|
||||
$db=getDoliDBInstance('mysqli',$argv[3],$argv[6],$argv[7],$argv[5],$argv[4]);
|
||||
$db=getDoliDBInstance('mysqli',$argv[2],$argv[5],$argv[6],$argv[4],$argv[3]);
|
||||
}
|
||||
|
||||
if ($db->type != 'mysql' && $db->type != 'mysqli')
|
||||
@@ -68,18 +68,14 @@ if ($db->type != 'mysql' && $db->type != 'mysqli')
|
||||
exit;
|
||||
}
|
||||
|
||||
$table=$argv[1];
|
||||
$module=$argv[2];
|
||||
|
||||
// Show parameters
|
||||
print 'Tablename: '.$table."\n";
|
||||
print 'Modulename: '.$module."\n";
|
||||
print "Current dir: ".getcwd()."\n";
|
||||
print "Database name: ".$db->database_name."\n";
|
||||
print 'Tablename='.$argv[1]."\n";
|
||||
print "Current dir is ".getcwd()."\n";
|
||||
|
||||
|
||||
// Define array with list of properties
|
||||
$property=array();
|
||||
$table=$argv[1];
|
||||
$foundprimary=0;
|
||||
$resql=$db->DDLDescTable($table);
|
||||
if ($resql)
|
||||
@@ -121,14 +117,6 @@ if ($resql)
|
||||
{
|
||||
$property[$i]['ischar']=false;
|
||||
}
|
||||
if (preg_match('/int/i',$property[$i]['type']))
|
||||
{
|
||||
$property[$i]['isint']=true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$property[$i]['isint']=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -147,7 +135,7 @@ foreach($property as $key => $prop)
|
||||
$i++;
|
||||
if ($prop['field'] != 'rowid')
|
||||
{
|
||||
$varpropselect.="\t\t\$sql .= \" ";
|
||||
$varpropselect.="\t\t\$sql.= \" ";
|
||||
$varpropselect.="t.".$prop['field'];
|
||||
if ($i < count($property)) $varpropselect.=",";
|
||||
$varpropselect.="\";";
|
||||
@@ -163,7 +151,7 @@ foreach($property as $key => $prop)
|
||||
|
||||
// Define working variables
|
||||
$table=strtolower($table);
|
||||
$tablenoprefix=preg_replace('/'.preg_quote(MAIN_DB_PREFIX,'/').'/i','',$table);
|
||||
$tablenoprefix=preg_replace('/'.preg_quote(MAIN_DB_PREFIX).'/i','',$table);
|
||||
$classname=preg_replace('/_/','',ucfirst($tablenoprefix));
|
||||
$classmin=preg_replace('/_/','',strtolower($classname));
|
||||
|
||||
@@ -183,18 +171,11 @@ if (! $sourcecontent)
|
||||
$outfile='out.'.$classmin.'.class.php';
|
||||
$targetcontent=$sourcecontent;
|
||||
|
||||
// Substitute module name
|
||||
$targetcontent=preg_replace('/dev\/skeletons/', $module, $targetcontent);
|
||||
$targetcontent=preg_replace('/mymodule othermodule1 othermodule2/', $module, $targetcontent);
|
||||
$targetcontent=preg_replace('/mymodule/', $module, $targetcontent);
|
||||
|
||||
// Substitute class name
|
||||
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$element = \'skeleton\'/', '\$element = \''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$table_element = \'skeleton\'/', '\$table_element = \''.$tablenoprefix.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
|
||||
$targetcontent=preg_replace('/skeletons/', $classmin, $targetcontent);
|
||||
$targetcontent=preg_replace('/skeleton/', $classmin, $targetcontent);
|
||||
|
||||
// Substitute comments
|
||||
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
|
||||
@@ -211,18 +192,15 @@ foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id')
|
||||
{
|
||||
$varprop.="\tpublic \$".$prop['field'];
|
||||
if ($prop['istime']) $varprop.=" = ''";
|
||||
$varprop.="\tvar \$".$prop['field'];
|
||||
if ($prop['istime']) $varprop.="=''";
|
||||
$varprop.=";";
|
||||
if ($prop['comment']) $varprop.="\t// ".$prop['extra'];
|
||||
$varprop.="\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/'.preg_quote('public $prop1;','/').'/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/'.preg_quote('public $prop2;','/').'/', '', $targetcontent);
|
||||
|
||||
$targetcontent=preg_replace('/\*((\s|\n|\r|\t)*)\@var mixed Sample property 1((\s|\n|\r|\t)*)/', '', $targetcontent);
|
||||
$targetcontent=preg_replace('/\*((\s|\n|\r|\t)*)\@var mixed Sample property 2((\s|\n|\r|\t)*)/', '', $targetcontent);
|
||||
$targetcontent=preg_replace('/var \$prop1;/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/var \$prop2;/', '', $targetcontent);
|
||||
|
||||
// Substitute clean parameters
|
||||
$varprop="\n";
|
||||
@@ -231,20 +209,13 @@ foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
|
||||
{
|
||||
$varprop.="\t\tif (isset(\$this->".$prop['field'].")) {\n\t\t\t \$this->".$prop['field']." = trim(\$this->".$prop['field'].");\n\t\t}";
|
||||
$varprop.="\t\tif (isset(\$this->".$prop['field'].")) \$this->".$prop['field']."=trim(\$this->".$prop['field'].");";
|
||||
$varprop.="\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/if \(isset\(\$this->prop1\)\) {((\n|\r|\t)*)\$this->prop1 = trim\(\$this->prop1\);((\n|\r|\t)*)}/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/if \(isset\(\$this->prop2\)\) {((\n|\r|\t)*)\$this->prop2 = trim\(\$this->prop2\);((\n|\r|\t)*)}/', '', $targetcontent);
|
||||
$targetcontent=preg_replace('/if \(isset\(\$this->prop1\)\) \$this->prop1=trim\(\$this->prop1\);/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/if \(isset\(\$this->prop2\)\) \$this->prop2=trim\(\$this->prop2\);/', '', $targetcontent);
|
||||
|
||||
|
||||
$no_output_field=0;
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['field'] == 'tms') $no_output_field++; // This is a field of type timestamp edited automatically
|
||||
if ($prop['extra'] == 'auto_increment') $no_output_field++;
|
||||
}
|
||||
// Substitute insert into parameters
|
||||
$varprop="\n";
|
||||
$cleanparam='';
|
||||
@@ -258,141 +229,102 @@ foreach($property as $key => $prop)
|
||||
|
||||
if ($addfield)
|
||||
{
|
||||
$varprop.="\t\t\$sql.= '".$prop['field'];
|
||||
if ($i <= count($property)-$no_output_field) $varprop.=",";
|
||||
$varprop.="';";
|
||||
$varprop.="\t\t\$sql.= \"".$prop['field'];
|
||||
if ($i < count($property)) $varprop.=",";
|
||||
$varprop.="\";";
|
||||
$varprop.="\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/\$sql \.= \' field1,\';/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql \.= \' field2\';/', '', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\.= " field1,";/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\.= " field2";/', '', $targetcontent);
|
||||
|
||||
// Substitute insert values parameters
|
||||
$varprop="\n";
|
||||
$cleanparam='';
|
||||
$i=0;
|
||||
|
||||
//Count nb field to output to manage commat at end SQL instruction
|
||||
|
||||
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
|
||||
$i++;
|
||||
$addfield=1;
|
||||
if ($prop['field'] == 'tms') $addfield=0; // This is a field of type timestamp edited automatically
|
||||
if ($prop['extra'] == 'auto_increment') $addfield=0;
|
||||
|
||||
|
||||
if ($addfield)
|
||||
{
|
||||
$i++;
|
||||
|
||||
$varprop.="\t\t\$sql .= ' ";
|
||||
if ($prop['field']=='datec')
|
||||
$varprop.="\t\t\$sql.= \" ";
|
||||
if ($prop['istime'])
|
||||
{
|
||||
$varprop.='\'."\'".$this->db->idate(dol_now())."\'"';
|
||||
}
|
||||
elseif ($prop['istime'])
|
||||
{
|
||||
$varprop.='\'.(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':"\'".$this->db->idate(';
|
||||
$varprop.="\$this->".$prop['field'];
|
||||
$varprop.=").\"'\")";
|
||||
$varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':"\'".$this->db->idate(';
|
||||
$varprop.="\$this->".$prop['field']."";
|
||||
$varprop.=')."\'")."';
|
||||
if ($i < count($property)) $varprop.=",";
|
||||
$varprop.='";';
|
||||
}
|
||||
elseif ($prop['ischar'])
|
||||
{
|
||||
$varprop.="'.(! isset(\$this->".$prop['field'].")?'NULL':\"'\".";
|
||||
$varprop.="\$this->db->escape(\$this->".$prop['field'].")";
|
||||
$varprop.=".\"'\")";
|
||||
}
|
||||
elseif ($prop['field']=='fk_user_mod' || $prop['field']=='fk_user_author')
|
||||
{
|
||||
$varprop.="'.\$user->id";
|
||||
}
|
||||
elseif ($prop['isint'])
|
||||
{
|
||||
$varprop.='\'.(! isset($this->'.$prop['field'].')?\'NULL\':';
|
||||
$varprop.="\$this->".$prop['field'];
|
||||
$varprop.=')';
|
||||
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
||||
$varprop.='$this->db->escape($this->'.$prop['field'].')';
|
||||
$varprop.='."\'")."';
|
||||
if ($i < count($property)) $varprop.=",";
|
||||
$varprop.='";';
|
||||
}
|
||||
else
|
||||
{
|
||||
$varprop.='\'.(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
||||
$varprop.="\$this->".$prop['field'];
|
||||
$varprop.='."\'")';
|
||||
$varprop.='".(! isset($this->'.$prop['field'].')?\'NULL\':"\'".';
|
||||
$varprop.="\$this->".$prop['field']."";
|
||||
$varprop.='."\'")."';
|
||||
if ($i < count($property)) $varprop.=",";
|
||||
$varprop.='";';
|
||||
}
|
||||
|
||||
if ($i < (count($property)-$no_output_field)) $varprop.=".','";
|
||||
$varprop.=';';
|
||||
$varprop.="\n";
|
||||
}
|
||||
}
|
||||
|
||||
$patern1='/\$sql \.= \' (.*)\' \. \$this->prop1 \. \'(.*),\';/';
|
||||
$patern2='/\$sql \.= \' (.*)\' \. \$this->prop2 \. \'(.*)\';/';
|
||||
$targetcontent=preg_replace($patern1, $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace($patern2, '', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\.= " \'".\$this->prop1\."\',";/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\.= " \'".\$this->prop2\."\'";/', '', $targetcontent);
|
||||
|
||||
// Substitute update values parameters
|
||||
|
||||
//Count nb field to output to manage commat at end SQL instruction
|
||||
$no_output_field=0;
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['extra'] == 'auto_increment') $no_output_field++;
|
||||
}
|
||||
|
||||
$varprop="\n";
|
||||
$cleanparam='';
|
||||
$i=0;
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
|
||||
$addfield=1;
|
||||
if ($prop['extra'] == 'auto_increment') $addfield=0;
|
||||
|
||||
if ($addfield)
|
||||
$i++;
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id')
|
||||
{
|
||||
$i++;
|
||||
|
||||
$varprop.="\t\t\$sql .= ' ";
|
||||
$varprop.=$prop['field'].' = ';
|
||||
if ($prop['field']=='tms') {
|
||||
$varprop.='\'.(dol_strlen($this->'.$prop['field'].') != 0 ? "\'".$this->db->idate(';
|
||||
$varprop.='$this->'.$prop['field'];
|
||||
$varprop.=')."\'" : "\'".$this->db->idate(dol_now())."\'")';
|
||||
}
|
||||
elseif ($prop['istime'])
|
||||
$varprop.="\t\t\$sql.= \" ";
|
||||
$varprop.=$prop['field'].'=';
|
||||
if ($prop['istime'])
|
||||
{
|
||||
$varprop.='\'.(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].') != 0 ? "\'".$this->db->idate(';
|
||||
// (dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
|
||||
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
|
||||
$varprop.='$this->'.$prop['field'];
|
||||
$varprop.=')."\'" : \'null\')';
|
||||
}
|
||||
|
||||
elseif ($prop['field']=='fk_user_mod') {
|
||||
$varprop.="'.\$user->id";
|
||||
$varprop.=')."\'" : \'null\').';
|
||||
$varprop.='"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$varprop.="'.";
|
||||
$varprop.="\".";
|
||||
// $sql.= " field1=".(isset($this->field1)?"'".$this->db->escape($this->field1)."'":"null").",";
|
||||
if ($prop['ischar']) $varprop.='(isset($this->'.$prop['field'].')?"\'".$this->db->escape($this->'.$prop['field'].')."\'":"null")';
|
||||
elseif ($prop['isint']) $varprop.='(isset($this->'.$prop['field'].')?$this->'.$prop['field'].':"null")';
|
||||
// $sql.= " field1=".(isset($this->field1)?$this->field1:"null").",";
|
||||
else $varprop.='(isset($this->'.$prop['field'].')?$this->'.$prop['field'].':"null")';
|
||||
$varprop.=".\"";
|
||||
}
|
||||
|
||||
if ($i < (count($property)-$no_output_field)) $varprop.=".','";
|
||||
$varprop.=';';
|
||||
if ($i < count($property)) $varprop.=',';
|
||||
$varprop.='";';
|
||||
$varprop.="\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/\$sql \.= " field1=".\(isset\(\$this->field1\)\?"\'".\$this->db->escape\(\$this->field1\)."\'":"null"\).",";/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql \.= " field2=".\(isset\(\$this->field2\)\?"\'".\$this->db->escape\(\$this->field2\)."\'":"null"\)."";/', '', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql.= " field1=".\(isset\(\$this->field1\)\?"\'".\$this->db->escape\(\$this->field1\)."\'":"null"\).",";/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql.= " field2=".\(isset\(\$this->field2\)\?"\'".\$this->db->escape\(\$this->field2\)."\'":"null"\)."";/', '', $targetcontent);
|
||||
|
||||
// Substitute fetch/select parameters
|
||||
$targetcontent=preg_replace('/\$sql \.= \' t\.field1,\';/', $varpropselect, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql \.= \' t\.field2\';/', '', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\.= " t\.field1,";/', $varpropselect, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
|
||||
|
||||
// Substitute select set parameters
|
||||
$varprop="\n";
|
||||
$varpropline="\n";
|
||||
$cleanparam='';
|
||||
$i=0;
|
||||
foreach($property as $key => $prop)
|
||||
@@ -406,22 +338,11 @@ foreach($property as $key => $prop)
|
||||
if ($prop['istime']) $varprop.=')';
|
||||
$varprop.=";";
|
||||
$varprop.="\n";
|
||||
|
||||
$varpropline.="\t\t\t\t\$line->".$prop['field']." = ";
|
||||
if ($prop['istime']) $varpropline.='$this->db->jdate(';
|
||||
$varpropline.='$obj->'.$prop['field'];
|
||||
if ($prop['istime']) $varpropline.=')';
|
||||
$varpropline.=";";
|
||||
$varpropline.="\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/\$this->prop1 = \$obj->field1;/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$this->prop2 = \$obj->field2;/', '', $targetcontent);
|
||||
|
||||
//Substirute fetchAll
|
||||
$targetcontent=preg_replace('/\$line->prop1 = \$obj->field1;/', $varpropline, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$line->prop2 = \$obj->field2;/', '', $targetcontent);
|
||||
|
||||
|
||||
// Substitute initasspecimen parameters
|
||||
$varprop="\n";
|
||||
@@ -430,12 +351,12 @@ foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id')
|
||||
{
|
||||
$varprop.="\t\t\$this->".$prop['field']." = '';";
|
||||
$varprop.="\t\t\$this->".$prop['field']."='';";
|
||||
$varprop.="\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/\$this->prop1 = \'prop1\';/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$this->prop2 = \'prop2\';/', '', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$this->prop1=\'prop1\';/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$this->prop2=\'prop2\';/', '', $targetcontent);
|
||||
|
||||
// Build file
|
||||
$fp=fopen($outfile,"w");
|
||||
@@ -449,7 +370,6 @@ if ($fp)
|
||||
else $error++;
|
||||
|
||||
|
||||
|
||||
//--------------------------------
|
||||
// Build skeleton_script.php
|
||||
//--------------------------------
|
||||
@@ -469,19 +389,12 @@ if (! $sourcecontent)
|
||||
$outfile='out.'.$classmin.'_script.php';
|
||||
$targetcontent=$sourcecontent;
|
||||
|
||||
// Substitute module name
|
||||
$targetcontent=preg_replace('/dev\/skeletons/', $module, $targetcontent);
|
||||
$targetcontent=preg_replace('/mymodule othermodule1 othermodule2/', $module, $targetcontent);
|
||||
$targetcontent=preg_replace('/mymodule/', $module, $targetcontent);
|
||||
|
||||
// Substitute class name
|
||||
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
|
||||
$targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$element = \'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$table_element = \'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
|
||||
$targetcontent=preg_replace('/skeletons/', $classmin, $targetcontent);
|
||||
$targetcontent=preg_replace('/skeleton/', $classmin, $targetcontent);
|
||||
|
||||
// Substitute comments
|
||||
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
|
||||
@@ -522,19 +435,13 @@ if (! $sourcecontent)
|
||||
$outfile='out.'.$classmin.'_page.php';
|
||||
$targetcontent=$sourcecontent;
|
||||
|
||||
// Substitute module name
|
||||
$targetcontent=preg_replace('/dev\/skeletons/', $module, $targetcontent);
|
||||
$targetcontent=preg_replace('/mymodule othermodule1 othermodule2/', $module, $targetcontent);
|
||||
$targetcontent=preg_replace('/mymodule/', $module, $targetcontent);
|
||||
|
||||
// Substitute class name
|
||||
$targetcontent=preg_replace('/skeleton_class\.class\.php/', $classmin.'.class.php', $targetcontent);
|
||||
$targetcontent=preg_replace('/skeleton_script\.php/', $classmin.'_script.php', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$element = \'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$table_element = \'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$element=\'skeleton\'/', '\$element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/\$table_element=\'skeleton\'/', '\$table_element=\''.$classmin.'\'', $targetcontent);
|
||||
$targetcontent=preg_replace('/Skeleton_Class/', $classname, $targetcontent);
|
||||
$targetcontent=preg_replace('/skeletons/', $classmin, $targetcontent);
|
||||
$targetcontent=preg_replace('/skeleton/', $classmin, $targetcontent);
|
||||
$targetcontent=preg_replace('/skeleton/', $classname, $targetcontent);
|
||||
|
||||
// Substitute comments
|
||||
$targetcontent=preg_replace('/This file is an example to create a new class file/', 'Put here description of this class', $targetcontent);
|
||||
@@ -544,79 +451,9 @@ $targetcontent=preg_replace('/Put here some comments/','Initialy built by build_
|
||||
// Substitute table name
|
||||
$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent);
|
||||
|
||||
// Substitute GETPOST search_fieldx
|
||||
$varprop="\n";
|
||||
$cleanparam='';
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
|
||||
{
|
||||
if ($prop['isint']) $varprop.='$search_'.$prop['field']."=GETPOST('search_".$prop['field']."','int');\n";
|
||||
else $varprop.='$search_'.$prop['field']."=GETPOST('search_".$prop['field']."','alpha');\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/'.preg_quote('$search_field1=GETPOST("search_field1");','/').'/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/'.preg_quote('$search_field2=GETPOST("search_field2");','/').'/', '', $targetcontent);
|
||||
|
||||
// Substitute GETPOST fieldx
|
||||
$varprop="\n";
|
||||
$cleanparam='';
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
|
||||
{
|
||||
if ($prop['isint']) $varprop.="\t\$object->".$prop['field']."=GETPOST('".$prop['field']."','int');\n";
|
||||
else $varprop.="\t\$object->".$prop['field']."=GETPOST('".$prop['field']."','alpha');\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/'.preg_quote('$object->prop1=GETPOST("field1");','/').'/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/'.preg_quote('$object->prop2=GETPOST("field2");','/').'/', '', $targetcontent);
|
||||
|
||||
// Substitute fetch/select parameters
|
||||
$targetcontent=preg_replace('/\$sql\s*\.= " t\.field1,";/', $varpropselect, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\s*\.= " t\.field2";/', '', $targetcontent);
|
||||
|
||||
// Substitute where for search
|
||||
$varprop="\n";
|
||||
$cleanparam='';
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
|
||||
{
|
||||
$varprop.='if ($search_'.$prop['field'].') $sql.= natural_search("'.$prop['field'].'",$search_'.$prop['field'].');'."\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/'.preg_quote('if ($search_field1) $sql.= natural_search("field1",$search_field1);','/').'/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/'.preg_quote('if ($search_field2) $sql.= natural_search("field2",$search_field2);','/').'/', '', $targetcontent);
|
||||
|
||||
// Substitute print_liste_field_titre
|
||||
$varprop="\n";
|
||||
$cleanparam='';
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
|
||||
{
|
||||
$varprop.="print_liste_field_titre(\$langs->trans('".$prop['field']."'),\$_SERVER['PHP_SELF'],'t.".$prop['field']."','',\$param,'',\$sortfield,\$sortorder);\n";
|
||||
}
|
||||
}
|
||||
|
||||
$targetcontent=preg_replace('/'.preg_quote("print_liste_field_titre(\$langs->trans('field1'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/'.preg_quote("print_liste_field_titre(\$langs->trans('field2'),\$_SERVER['PHP_SELF'],'t.field1','',\$param,'',\$sortfield,\$sortorder);",'/').'/', '', $targetcontent);
|
||||
|
||||
// Substitute where for <td>.fieldx.</td>
|
||||
$varprop="\n";
|
||||
$cleanparam='';
|
||||
foreach($property as $key => $prop)
|
||||
{
|
||||
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
|
||||
{
|
||||
$varprop.="print '<td>'.\$obj->".$prop['field'].".'</td>';\n";
|
||||
}
|
||||
}
|
||||
$targetcontent=preg_replace('/'.preg_quote("print '<td>'.\$obj->field1.'</td>';",'/').'/', $varprop, $targetcontent);
|
||||
$targetcontent=preg_replace('/'.preg_quote("print '<td>'.\$obj->field2.'</td>';",'/').'/', '', $targetcontent);
|
||||
|
||||
|
||||
$targetcontent=preg_replace('/\$sql\.= " t\.field1,";/', $varpropselect, $targetcontent);
|
||||
$targetcontent=preg_replace('/\$sql\.= " t\.field2";/', '', $targetcontent);
|
||||
|
||||
// Build file
|
||||
$fp=fopen($outfile,"w");
|
||||
|
||||
@@ -34,11 +34,11 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
class modMyModule extends DolibarrModules
|
||||
{
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
function __construct($db)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
@@ -57,7 +57,7 @@ class modMyModule extends DolibarrModules
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
|
||||
$this->description = "Description of module MyModule";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = '1.0';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
@@ -167,12 +167,6 @@ class modMyModule extends DolibarrModules
|
||||
// Example:
|
||||
//$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>'')););
|
||||
|
||||
// Cronjobs
|
||||
$this->cronjobs = array(); // List of cron jobs entries to add
|
||||
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>3600, 'unitfrequency'=>3600)
|
||||
// );
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
$r=0;
|
||||
@@ -186,6 +180,7 @@ class modMyModule extends DolibarrModules
|
||||
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
// $r++;
|
||||
|
||||
|
||||
// Main menu entries
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r=0;
|
||||
@@ -193,7 +188,7 @@ class modMyModule extends DolibarrModules
|
||||
// Add here entries to declare new menus
|
||||
//
|
||||
// Example to declare a new Top Menu entry and its Left menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
// $this->menu[$r]=array( 'fk_menu'=>0, // Put 0 if this is a top menu
|
||||
// 'type'=>'top', // This is a Top menu entry
|
||||
// 'titre'=>'MyModule top menu',
|
||||
// 'mainmenu'=>'mymodule',
|
||||
@@ -208,7 +203,7 @@ class modMyModule extends DolibarrModules
|
||||
// $r++;
|
||||
//
|
||||
// Example to declare a Left Menu entry into an existing Top menu entry:
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
// $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=xxx', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
// 'type'=>'left', // This is a Left menu entry
|
||||
// 'titre'=>'MyModule left menu',
|
||||
// 'mainmenu'=>'xxx',
|
||||
@@ -228,14 +223,11 @@ class modMyModule extends DolibarrModules
|
||||
|
||||
// Example:
|
||||
// $this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
// $this->export_label[$r]='MyModule'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
// $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
// $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled.
|
||||
// $this->export_icon[$r]='generic:MyModule';
|
||||
// $this->export_permission[$r]=array(array("mymodule","level1","level2"));
|
||||
// $this->export_permission[$r]=array(array("facture","facture","export"));
|
||||
// $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef');
|
||||
// $this->export_TypeFields_array[$r]=array('t.date'=>'Date', 't.qte'=>'Numeric', 't.poids'=>'Numeric', 't.fad'=>'Numeric', 't.paq'=>'Numeric', 't.stockage'=>'Numeric', 't.fadparliv'=>'Numeric', 't.livau100'=>'Numeric', 't.forfait'=>'Numeric', 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
|
||||
// $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product');
|
||||
// $this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
// $this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
// $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'facturedet as fd, '.MAIN_DB_PREFIX.'societe as s)';
|
||||
// $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
|
||||
@@ -252,24 +244,24 @@ class modMyModule extends DolibarrModules
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options='')
|
||||
function init($options='')
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
//$this->_load_tables('/mymodule/sql/');
|
||||
$result=$this->_load_tables('/mymodule/sql/');
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function remove($options = '')
|
||||
function remove($options='')
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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/>.
|
||||
*/
|
||||
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
|
||||
/**
|
||||
* API class for skeleton object
|
||||
*
|
||||
* @smart-auto-routing false
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
*
|
||||
*
|
||||
*/
|
||||
class SkeletonApi extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $FIELDS = array(
|
||||
'name'
|
||||
);
|
||||
|
||||
/**
|
||||
* @var Skeleton $skeleton {@type Skeleton}
|
||||
*/
|
||||
public $skeleton;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @url GET skeleton/
|
||||
*
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
global $db, $conf;
|
||||
$this->db = $db;
|
||||
$this->skeleton = new Skeleton($this->db);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of a skeleton object
|
||||
*
|
||||
* Return an array with skeleton informations
|
||||
*
|
||||
* @param int $id ID of skeleton
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET skeleton/{id}
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->skeleton->read) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->skeleton->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Skeleton not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('skeleton',$this->skeleton->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->skeleton);
|
||||
}
|
||||
|
||||
/**
|
||||
* List skeletons
|
||||
*
|
||||
* Get a list of skeletons
|
||||
*
|
||||
* @param int $mode Use this param to filter list
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
*
|
||||
* @return array Array of skeleton objects
|
||||
*
|
||||
* @url GET /skeletons/
|
||||
*/
|
||||
function getList($mode, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||
|
||||
$sql = "SELECT s.rowid";
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."skeleton as s";
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
$sql.= " WHERE s.fk_stcomm = st.id";
|
||||
|
||||
// Example of use $mode
|
||||
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
|
||||
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
|
||||
|
||||
$sql.= ' AND s.entity IN ('.getEntity('skeleton', 1).')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc";
|
||||
if ($socid) $sql.= " AND s.fk_soc = ".$socid;
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
$sql .= " AND sc.fk_user = ".$search_sale;
|
||||
}
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$skeleton_static = new Skeleton($db);
|
||||
if($skeleton_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = parent::_cleanObjectDatas($skeleton_static);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve skeleton list');
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
throw new RestException(404, 'No skeleton found');
|
||||
}
|
||||
return $obj_ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create skeleton object
|
||||
*
|
||||
* @param array $request_data Request datas
|
||||
* @return int ID of skeleton
|
||||
*
|
||||
* @url POST skeleton/
|
||||
*/
|
||||
function post($request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->skeleton->create) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
$this->skeleton->$field = $value;
|
||||
}
|
||||
if( ! $this->skeleton->create(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500);
|
||||
}
|
||||
return $this->skeleton->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update skeleton
|
||||
*
|
||||
* @param int $id Id of skeleton to update
|
||||
* @param array $request_data Datas
|
||||
* @return int
|
||||
*
|
||||
* @url PUT skeleton/{id}
|
||||
*/
|
||||
function put($id, $request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->skeleton->create) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->skeleton->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Skeleton not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('skeleton',$this->skeleton->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
$this->skeleton->$field = $value;
|
||||
}
|
||||
|
||||
if($this->skeleton->update($id, DolibarrApiAccess::$user))
|
||||
return $this->get ($id);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete skeleton
|
||||
*
|
||||
* @param int $id Skeleton ID
|
||||
* @return array
|
||||
*
|
||||
* @url DELETE skeleton/{id}
|
||||
*/
|
||||
function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->skeleton->supprimer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->skeleton->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Skeleton not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('skeleton',$this->skeleton->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if( !$this->skeleton->delete($id))
|
||||
{
|
||||
throw new RestException(500);
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Skeleton deleted'
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate fields before create or update object
|
||||
*
|
||||
* @param array $data Data to validate
|
||||
* @return array
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function _validate($data)
|
||||
{
|
||||
$skeleton = array();
|
||||
foreach (SkeletonApi::$FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, "$field field missing");
|
||||
$skeleton[$field] = $data[$field];
|
||||
}
|
||||
return $skeleton;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -20,455 +18,352 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/skeletons/skeleton_class.class.php
|
||||
* \ingroup mymodule othermodule1 othermodule2
|
||||
* \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
|
||||
* Put some comments here
|
||||
* \file dev/skeletons/skeleton_class.class.php
|
||||
* \ingroup mymodule othermodule1 othermodule2
|
||||
* \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
|
||||
* Put here some comments
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||
//require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
|
||||
|
||||
|
||||
/**
|
||||
* Class Skeleton_Class
|
||||
*
|
||||
* Put here description of your class
|
||||
* Put here description of your class
|
||||
*/
|
||||
class Skeleton_Class extends CommonObject
|
||||
{
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
* @deprecated
|
||||
* @see Skeleton_Class::errors
|
||||
*/
|
||||
public $error;
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
/**
|
||||
* @var string Id to identify managed objects
|
||||
*/
|
||||
public $element = 'skeleton';
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'skeleton';
|
||||
var $db; //!< To store db handler
|
||||
var $error; //!< To return error code (or message)
|
||||
var $errors=array(); //!< To return several error codes (or messages)
|
||||
var $element='skeleton'; //!< Id that identify managed objects
|
||||
var $table_element='skeleton'; //!< Name of table without prefix where object is stored
|
||||
|
||||
/**
|
||||
* @var Skeleton_ClassLine[] Lines
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @var mixed Sample property 1
|
||||
*/
|
||||
public $prop1;
|
||||
/**
|
||||
* @var mixed Sample property 2
|
||||
*/
|
||||
public $prop2;
|
||||
var $id;
|
||||
var $prop1;
|
||||
var $prop2;
|
||||
//...
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->prop1)) {
|
||||
$this->prop1 = trim($this->prop1);
|
||||
}
|
||||
if (isset($this->prop2)) {
|
||||
$this->prop2 = trim($this->prop2);
|
||||
}
|
||||
if (isset($this->prop1)) $this->prop1=trim($this->prop1);
|
||||
if (isset($this->prop2)) $this->prop2=trim($this->prop2);
|
||||
//...
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||
$sql .= ' field1,';
|
||||
$sql .= ' field2';
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."(";
|
||||
$sql.= " field1,";
|
||||
$sql.= " field2";
|
||||
//...
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' \'' . $this->prop1 . '\',';
|
||||
$sql .= ' \'' . $this->prop2 . '\'';
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " '".$this->prop1."',";
|
||||
$sql.= " '".$this->prop2."'";
|
||||
//...
|
||||
$sql .= ')';
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
|
||||
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action to call a trigger.
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||
//if ($result < 0) $error++;
|
||||
//// End call triggers
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
|
||||
return $this->id;
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= ' t.field1,';
|
||||
$sql .= ' t.field2';
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id,$ref='')
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.field1,";
|
||||
$sql.= " t.field2";
|
||||
//...
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
if (null !== $ref) {
|
||||
$sql .= ' WHERE t.ref = ' . '\'' . $ref . '\'';
|
||||
} else {
|
||||
$sql .= ' WHERE t.rowid = ' . $id;
|
||||
}
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
|
||||
if ($ref) $sql.= " WHERE t.ref = '".$ref."'";
|
||||
else $sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
if ($numrows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
dol_syslog(get_class($this)."::fetch");
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->prop1 = $obj->field1;
|
||||
$this->prop2 = $obj->field2;
|
||||
$this->id = $obj->rowid;
|
||||
$this->prop1 = $obj->field1;
|
||||
$this->prop2 = $obj->field2;
|
||||
//...
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($numrows) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= ' t.field1,';
|
||||
$sql .= ' t.field2';
|
||||
//...
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new Skeleton_ClassLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
$line->prop1 = $obj->field1;
|
||||
$line->prop2 = $obj->field2;
|
||||
|
||||
$this->lines[] = $line;
|
||||
//...
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user, $notrigger=0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->prop1)) {
|
||||
$this->prop1 = trim($this->prop1);
|
||||
}
|
||||
if (isset($this->prop2)) {
|
||||
$this->prop2 = trim($this->prop2);
|
||||
}
|
||||
if (isset($this->prop1)) $this->prop1=trim($this->prop1);
|
||||
if (isset($this->prop2)) $this->prop2=trim($this->prop2);
|
||||
//...
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||
$sql .= " field1=".(isset($this->field1)?"'".$this->db->escape($this->field1)."'":"null").",";
|
||||
$sql .= " field2=".(isset($this->field2)?"'".$this->db->escape($this->field2)."'":"null")."";
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
|
||||
$sql.= " field1=".(isset($this->field1)?"'".$this->db->escape($this->field1)."'":"null").",";
|
||||
$sql.= " field2=".(isset($this->field2)?"'".$this->db->escape($this->field2)."'":"null")."";
|
||||
//...
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(__METHOD__);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user User that deletes
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
function delete($user, $notrigger=0)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
dol_syslog(__METHOD__);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(__METHOD__." ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
*
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
global $user;
|
||||
$error = 0;
|
||||
$object = new Skeleton_Class($this->db);
|
||||
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
function createFromClone($fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
$object=new Skeleton_Class($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
$object->fetch($fromid);
|
||||
// Reset object
|
||||
$object->id = 0;
|
||||
$object->id=0;
|
||||
$object->statut=0;
|
||||
|
||||
// Clear fields
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$result = $object->create($user);
|
||||
$result=$object->create($user);
|
||||
|
||||
// Other options
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$this->errors = $object->errors;
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$object->error;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
||||
return $object->id;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
function initAsSpecimen()
|
||||
{
|
||||
$this->id = 0;
|
||||
$this->prop1 = 'prop1';
|
||||
$this->prop2 = 'prop2';
|
||||
$this->id=0;
|
||||
$this->prop1='prop1';
|
||||
$this->prop2='prop2';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Skeleton_ClassLine
|
||||
*/
|
||||
class Skeleton_ClassLine
|
||||
{
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @var mixed Sample line property 1
|
||||
*/
|
||||
public $prop1;
|
||||
/**
|
||||
* @var mixed Sample line property 2
|
||||
*/
|
||||
public $prop2;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -43,8 +43,8 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ
|
||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
dol_include_once('/mymodule/class/skeleton_class.class.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/formcompany.class.php');
|
||||
dol_include_once('/module/class/skeleton_class.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
$langs->load("companies");
|
||||
@@ -56,16 +56,13 @@ $action = GETPOST('action','alpha');
|
||||
$backtopage = GETPOST('backtopage');
|
||||
$myparam = GETPOST('myparam','alpha');
|
||||
|
||||
$search_field1=GETPOST("search_field1");
|
||||
$search_field2=GETPOST("search_field2");
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
//accessforbidden();
|
||||
}
|
||||
|
||||
if (empty($action) && empty($id) && empty($ref)) $action='list';
|
||||
if (empty($action) && empty($id) && empty($ref)) $action='create';
|
||||
|
||||
// Load object if id or ref is provided as parameter
|
||||
$object=new Skeleton_Class($db);
|
||||
@@ -75,10 +72,6 @@ if (($id > 0 || ! empty($ref)) && $action != 'add')
|
||||
if ($result < 0) dol_print_error($db);
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('skeleton'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
@@ -87,114 +80,108 @@ $extrafields = new ExtraFields($db);
|
||||
* Put here all code to do according to value of "action" parameter
|
||||
********************************************************************/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook))
|
||||
// Action to add record
|
||||
if ($action == 'add')
|
||||
{
|
||||
// Action to add record
|
||||
if ($action == 'add')
|
||||
if (GETPOST('cancel'))
|
||||
{
|
||||
if (GETPOST('cancel'))
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/buildingmanagement/list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
|
||||
$error=0;
|
||||
|
||||
/* object_prop_getpost_prop */
|
||||
$object->prop1=GETPOST("field1");
|
||||
$object->prop2=GETPOST("field2");
|
||||
|
||||
if (empty($object->ref))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Creation OK
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
|
||||
$error=0;
|
||||
|
||||
/* object_prop_getpost_prop */
|
||||
$object->prop1=GETPOST("field1");
|
||||
$object->prop2=GETPOST("field2");
|
||||
|
||||
if (empty($object->ref))
|
||||
{
|
||||
$error++;
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Creation OK
|
||||
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/list.php',1);
|
||||
header("Location: ".$urltogo);
|
||||
exit;
|
||||
}
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
|
||||
// Cancel
|
||||
if ($action == 'update' && GETPOST('cancel')) $action='view';
|
||||
|
||||
// Action to update record
|
||||
if ($action == 'update' && ! GETPOST('cancel'))
|
||||
else
|
||||
{
|
||||
$error=0;
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
|
||||
$object->prop1=GETPOST("field1");
|
||||
$object->prop2=GETPOST("field2");
|
||||
// Cancel
|
||||
if ($action == 'update' && GETPOST('cancel')) $action='view';
|
||||
|
||||
if (empty($object->ref))
|
||||
// Action to update record
|
||||
if ($action == 'update' && ! GETPOST('cancel'))
|
||||
{
|
||||
$error=0;
|
||||
|
||||
$object->prop1=GETPOST("field1");
|
||||
$object->prop2=GETPOST("field2");
|
||||
|
||||
if (empty($object->ref))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$object->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("Ref")),null,'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$result=$object->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$action='view';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='edit';
|
||||
}
|
||||
$action='view';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Creation KO
|
||||
if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
|
||||
else setEventMessages($object->error, null, 'errors');
|
||||
$action='edit';
|
||||
}
|
||||
}
|
||||
|
||||
// Action to delete
|
||||
if ($action == 'confirm_delete')
|
||||
else
|
||||
{
|
||||
$result=$object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Delete OK
|
||||
setEventMessages("RecordDeleted", null, 'mesgs');
|
||||
header("Location: ".dol_buildpath('/buildingmanagement/list.php',1));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors');
|
||||
else setEventMessages($object->error,null,'errors');
|
||||
}
|
||||
$action='edit';
|
||||
}
|
||||
}
|
||||
|
||||
// Action to delete
|
||||
if ($action == 'confirm_delete')
|
||||
{
|
||||
$result=$object->delete($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Delete OK
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
|
||||
header("Location: ".dol_buildpath('/buildingmanagement/list.php',1));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! empty($object->errors)) setEventMessages(null,$object->errors,'errors');
|
||||
else setEventMessages($object->error,null,'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -221,96 +208,34 @@ jQuery(document).ready(function() {
|
||||
}
|
||||
init_myfunc();
|
||||
jQuery("#mybutton").click(function() {
|
||||
init_myfunc();
|
||||
init_needroot();
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
|
||||
// Part to show a list
|
||||
if ($action == 'list' || (empty($id) && $action != 'create'))
|
||||
if ($action == 'list' || empty($id))
|
||||
{
|
||||
// Put here content of your page
|
||||
print load_fiche_titre('PageTitle');
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.field1,";
|
||||
$sql.= " t.field2";
|
||||
// Add fields for extrafields
|
||||
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
|
||||
$sql.= " WHERE 1 = 1";
|
||||
if ($search_field1) $sql.= natural_search("field1",$search_field1);
|
||||
if ($search_field2) $sql.= natural_search("field2",$search_field2);
|
||||
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " WHERE field3 = 'xxx'";
|
||||
$sql.= " ORDER BY field1 ASC";
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||
|
||||
print '<table class="noborder">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||
print '</tr>';
|
||||
|
||||
dol_syslog($script_file, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$params='';
|
||||
$params.= '&search_field1='.urlencode($search_field1);
|
||||
$params.= '&search_field2='.urlencode($search_field2);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"],$params,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies');
|
||||
|
||||
|
||||
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
if (! empty($moreforfilter))
|
||||
{
|
||||
print '<div class="liste_titre">';
|
||||
print $moreforfilter;
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<table class="noborder">'."\n";
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Fields title search
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_field1" value="'.$search_field1.'" size="10"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_field2" value="'.$search_field2.'" size="10"></td>';
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
@@ -318,32 +243,21 @@ if ($action == 'list' || (empty($id) && $action != 'create'))
|
||||
if ($obj)
|
||||
{
|
||||
// You can use here results
|
||||
print '<tr>';
|
||||
print '<td>'.$obj->field1.'</td>';
|
||||
print '<td>'.$obj->field2.'</td>';
|
||||
$parameters=array('obj' => $obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
print '</tr>';
|
||||
print '<tr><td>';
|
||||
print $obj->field1;
|
||||
print $obj->field2;
|
||||
print '</td></tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters=array('sql' => $sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print "</table>\n";
|
||||
print "</form>\n";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
$error++;
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>'."\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -351,14 +265,14 @@ if ($action == 'list' || (empty($id) && $action != 'create'))
|
||||
// Part to create
|
||||
if ($action == 'create')
|
||||
{
|
||||
print_fiche_titre($langs->trans("NewSkeleton"));
|
||||
print_fiche_titre($langs->trans("NewResidence"));
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border centpercent">'."\n";
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>';
|
||||
print '<input class="flat" type="text" size="36" name="label" value="'.$label.'">';
|
||||
@@ -366,11 +280,13 @@ if ($action == 'create')
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
dol_fiche_end();
|
||||
print '<br>';
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></div>';
|
||||
print '<center><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
@@ -378,19 +294,21 @@ if ($action == 'create')
|
||||
// Part to edit record
|
||||
if (($id || $ref) && $action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"></div>';
|
||||
print '<br>';
|
||||
|
||||
print '<center><input type="submit" class="button" name="add" value="'.$langs->trans("Create").'"></center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
}
|
||||
|
||||
|
||||
@@ -434,9 +352,8 @@ if ($id && (empty($action) || $action == 'view'))
|
||||
|
||||
|
||||
// Example 2 : Adding links to objects
|
||||
//$somethingshown=$form->showLinkedObjectBlock($object);
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object);
|
||||
//if ($linktoelem) print '<br>'.$linktoelem;
|
||||
// The class must extends CommonObject class to have this method available
|
||||
//$somethingshown=$object->showLinkedObjectBlock();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -9,24 +9,24 @@
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/dolibarrnew/theme/eldy/img/favicon.ico"/>
|
||||
<title>Login Dolibarr 3.4.0-alpha</title>
|
||||
<!-- Includes for JQuery (Ajax library) -->
|
||||
<link rel="stylesheet" type="text/css" href="/dolibarrnew/includes/jquery/css/smoothness/jquery-ui.custom.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/dolibarrnew/includes/jquery/css/smoothness/jquery-ui-latest.custom.css" />
|
||||
<link rel="stylesheet" type="text/css" title="default" href="/dolibarrnew/custom/filemanager/css/filemanager.css.php"><!-- Added by module filemanager-->
|
||||
<!-- Includes JS for JQuery -->
|
||||
<script type="text/javascript" src="/dolibarrnew/includes/jquery/js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/dolibarrnew/includes/jquery/js/jquery-latest.min.js"></script>
|
||||
<script type="text/javascript" src="/dolibarrnew/core/js/dst.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/dolibarrnew/theme/eldy/style.css.php?lang=fr_FR" />
|
||||
<!-- HTTP_USER_AGENT = Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22 -->
|
||||
</head>
|
||||
<body class="body">
|
||||
|
||||
<div class="center">
|
||||
<center>
|
||||
|
||||
<div class="login_table" align="center">
|
||||
|
||||
<!-- <tr><td colspan="2" valign="middle"> -->
|
||||
<div id="login_line1" align="center">
|
||||
|
||||
<div id="login_left" style="display: inline-block; min-width: 250px; margin: 0 auto;"><div class="center">
|
||||
<div id="login_left" style="display: inline-block; min-width: 250px; margin: 0 auto;"><center>
|
||||
|
||||
<table class="none" summary="Login pass" cellpadding="2" align="center">
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</center>
|
||||
</div> <!-- end div left -->
|
||||
|
||||
<!-- </td>
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</center>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -40,18 +40,8 @@ class autoTranslator
|
||||
const DIR_SEPARATOR = '/';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $_destlang Destination lang
|
||||
* @param string $_refLang Ref lang
|
||||
* @param string $_langDir Dir lang
|
||||
* @param string $_limittofile Limit to file
|
||||
* @param string $_apikey Api key
|
||||
* @return void
|
||||
*/
|
||||
function __construct($_destlang,$_refLang,$_langDir,$_limittofile,$_apikey)
|
||||
{
|
||||
function __construct($_destlang,$_refLang,$_langDir,$_limittofile,$_apikey)
|
||||
{
|
||||
|
||||
// Set enviorment variables
|
||||
$this->_destlang = $_destlang;
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (c) 2015 Tommaso Basilici <t.basilici@19.coop>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
echo "<html>";
|
||||
echo "<head>";
|
||||
|
||||
echo "<STYLE type=\"text/css\">
|
||||
|
||||
table {
|
||||
background: #f5f5f5;
|
||||
border-collapse: separate;
|
||||
box-shadow: inset 0 1px 0 #fff;
|
||||
font-size: 12px;
|
||||
line-height: 24px;
|
||||
margin: 30px auto;
|
||||
text-align: left;
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #777;
|
||||
border-left: 1px solid #555;
|
||||
border-right: 1px solid #777;
|
||||
border-top: 1px solid #555;
|
||||
border-bottom: 1px solid #333;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
padding: 10px 15px;
|
||||
position: relative;
|
||||
text-shadow: 0 1px 0 #000;
|
||||
}
|
||||
|
||||
td {
|
||||
border-right: 1px solid #fff;
|
||||
border-left: 1px solid #e8e8e8;
|
||||
border-top: 1px solid #fff;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
padding: 10px 15px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
tr {
|
||||
background-color: #f1f1f1;
|
||||
|
||||
}
|
||||
|
||||
tr:nth-child(odd) td {
|
||||
background-color: #f1f1f1;
|
||||
}
|
||||
|
||||
</STYLE>";
|
||||
|
||||
echo "<body>";
|
||||
|
||||
echo "If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used.<br>";
|
||||
echo "IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly.<br>";
|
||||
echo "Happy translating :)<br>";
|
||||
|
||||
|
||||
// STEP 1 - Search duplicates keys
|
||||
|
||||
|
||||
// directory containing the php and lang files
|
||||
$htdocs = "../../htdocs/";
|
||||
|
||||
// directory containing the english lang files
|
||||
$workdir = $htdocs."langs/en_US/";
|
||||
|
||||
|
||||
$files = scandir($workdir);
|
||||
if (empty($files))
|
||||
{
|
||||
echo "Can't scan workdir = ".$workdir;
|
||||
exit;
|
||||
}
|
||||
|
||||
$exludefiles = array('.','..','README');
|
||||
$files = array_diff($files,$exludefiles);
|
||||
$langstrings_3d = array();
|
||||
$langstrings_full = array();
|
||||
foreach ($files AS $file) {
|
||||
$path_file = pathinfo($file);
|
||||
// we're only interested in .lang files
|
||||
if ($path_file['extension']=='lang') {
|
||||
$content = file($workdir.$file);
|
||||
foreach ($content AS $line => $row) {
|
||||
// don't want comment lines
|
||||
if (substr($row,0,1) !== '#') {
|
||||
// don't want lines without the separator (why should those even be here, anyway...)
|
||||
if (strpos($row,'=')!==false) {
|
||||
$row_array = explode('=',$row); // $row_array[0] = key
|
||||
$langstrings_3d[$path_file['basename']][$line+1]=$row_array[0];
|
||||
$langstrings_3dtrans[$path_file['basename']][$line+1]=$row_array[1];
|
||||
$langstrings_full[]=$row_array[0];
|
||||
$langstrings_dist[$row_array[0]]=$row_array[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($langstrings_3d AS $filename => $file) {
|
||||
foreach ($file AS $linenum => $value) {
|
||||
$keys = array_keys($langstrings_full, $value);
|
||||
if (count($keys)>1)
|
||||
{
|
||||
foreach ($keys AS $key) {
|
||||
$dups[$value][$filename][$linenum] = trim($langstrings_3dtrans[$filename][$linenum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "<h2>Duplicate strings in lang files in $workdir - ".count($dups)." found</h2>";
|
||||
|
||||
echo "<table border_bottom=1> ";
|
||||
echo "<thead><tr><th align=\"center\">#</th><th>String</th><th>File and lines</th></thead>";
|
||||
echo "<tbody>";
|
||||
$count = 0;
|
||||
foreach ($dups as $string => $pages) {
|
||||
$count++;
|
||||
echo "<tr>";
|
||||
echo "<td align=\"center\">$count</td>";
|
||||
echo "<td>$string</td>";
|
||||
echo "<td>";
|
||||
foreach ($pages AS $page => $lines ) {
|
||||
echo "$page ";
|
||||
foreach ($lines as $line => $translatedvalue) {
|
||||
//echo "($line - ".(substr($translatedvalue,0,20)).") ";
|
||||
echo "($line - ".htmlentities($translatedvalue).") ";
|
||||
}
|
||||
echo "<br>";
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
echo "</tbody>";
|
||||
echo "</table>";
|
||||
|
||||
|
||||
// STEP 2 - Search key not used
|
||||
|
||||
|
||||
if (! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true')
|
||||
{
|
||||
foreach ($langstrings_dist AS $value)
|
||||
{
|
||||
$search = '\'trans("'.$value.'")\'';
|
||||
$string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'*';
|
||||
exec($string,$output);
|
||||
if (empty($output)) {
|
||||
$unused[$value] = true;
|
||||
echo $value.'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
echo "<h2>Strings in en_US that are never used</h2>";
|
||||
echo "<pre>";
|
||||
print_r($unused);
|
||||
echo "</pre>";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
echo "</body>";
|
||||
echo "</html>";
|
||||
@@ -2,9 +2,9 @@
|
||||
#------------------------------------------------------
|
||||
# Script to push language files to Transifex
|
||||
#
|
||||
# Laurent Destailleur (eldy) - eldy@users.sourceforge.net
|
||||
# Laurent Destailleur - eldy@users.sourceforge.net
|
||||
#------------------------------------------------------
|
||||
# Usage: txpush.sh (source|xx_XX) [-r dolibarr.file] [-f]
|
||||
# Usage: txpush.sh (source|all|xx_XX) [-r dolibarr.file] [-f]
|
||||
#------------------------------------------------------
|
||||
|
||||
# Syntax
|
||||
@@ -13,7 +13,7 @@ then
|
||||
echo "This push local files to transifex."
|
||||
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
|
||||
echo " Using -f will overwrite translation but not memory."
|
||||
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX) [-r dolibarr.file] [-f] [--no-interactive]"
|
||||
echo "Usage: ./dev/translation/txpush.sh (source|all|xx_XX) [-r dolibarr.file] [-f] [--no-interactive]"
|
||||
exit
|
||||
fi
|
||||
|
||||
@@ -23,16 +23,20 @@ then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "x$1" = "xall" ]
|
||||
then
|
||||
for fic in ar_SA bg_BG bs_BA ca_ES cs_CZ da_DK de_DE el_GR es_ES et_EE eu_ES fa_IR fi_FI fr_FR he_IL hr_HR hu_HU id_ID is_IS it_IT ja_JP ka_GE ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sk_SK sl_SI sq_AL sv_SE th_TH tr_TR uk_UA uz_UZ vi_VN zh_CN zh_TW
|
||||
do
|
||||
echo "tx push --skip -t -l $fic $2 $3"
|
||||
tx push --skip -t -l $fic $2 $3
|
||||
done
|
||||
else
|
||||
if [ "x$1" = "xsource" ]
|
||||
then
|
||||
echo "tx push -s $2 $3"
|
||||
tx push -s $2 $3
|
||||
else
|
||||
for file in `find htdocs/langs/$1/*.lang -type f`
|
||||
do
|
||||
echo $file
|
||||
export basefile=`basename $file | sed -s s/\.lang//g`
|
||||
echo "tx push --skip -r dolibarr.$basefile -t -l $1 $2 $3 $4"
|
||||
tx push --skip -r dolibarr.$basefile -t -l $1 $2 $3 $4
|
||||
done
|
||||
echo "tx push --skip -t -l $1 $2 $3 $4"
|
||||
tx push --skip -t -l $1 $2 $3 $4
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB |
3
htdocs/.gitignore
vendored
@@ -13,5 +13,4 @@
|
||||
/ultimatepdf*
|
||||
/lead
|
||||
/dolimed*
|
||||
/allscreens*
|
||||
/ecommerce/
|
||||
/allscreens*
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@@ -145,7 +145,6 @@ if ($result) {
|
||||
|
||||
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||
print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
||||
print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
||||
print '<br/><br/>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
@@ -155,7 +154,7 @@ if ($result) {
|
||||
print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Active"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
|
||||
print '</tr>';
|
||||
|
||||
@@ -173,20 +172,14 @@ if ($result) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = false;
|
||||
$var = true;
|
||||
|
||||
$accountstatic=new AccountingAccount($db);
|
||||
|
||||
while ( $i < min($num, $limit) )
|
||||
{
|
||||
while ( $i < min($num, $limit) ) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$accountstatic->id=$obj->rowid;
|
||||
$accountstatic->label=$obj->label;
|
||||
$accountstatic->account_number=$obj->account_number;
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
|
||||
print '<td><a href="./card.php?id=' . $obj->rowid . '">' . $obj->account_number . '</td>';
|
||||
print '<td>' . $obj->label . '</td>';
|
||||
print '<td>' . $obj->account_parent . '</td>';
|
||||
print '<td>' . $obj->pcg_type . '</td>';
|
||||
@@ -217,7 +210,6 @@ if ($result) {
|
||||
print '</td>' . "\n";
|
||||
|
||||
print "</tr>\n";
|
||||
$var=!$var;
|
||||
$i ++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -23,14 +23,12 @@
|
||||
* \brief Card accounting account
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
$error=0;
|
||||
|
||||
// Langs
|
||||
$langs->load("bills");
|
||||
$langs->load("accountancy");
|
||||
@@ -39,42 +37,41 @@ $mesg = '';
|
||||
$action = GETPOST('action');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
|
||||
// Security check
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
// Action
|
||||
if ($action == 'add')
|
||||
{
|
||||
if (! $cancel) {
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result = $db->query($sql);
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
|
||||
$accounting->fk_pcg_version = $obj->pcg_version;
|
||||
$accounting->pcg_type = GETPOST('pcg_type');
|
||||
$accounting->pcg_subtype = GETPOST('pcg_subtype');
|
||||
$accounting->account_number = GETPOST('account_number');
|
||||
$accounting->account_number = GETPOST('account_number', 'int');
|
||||
$accounting->account_parent = GETPOST('account_parent', 'int');
|
||||
$accounting->label = GETPOST('label', 'alpha');
|
||||
$accounting->active = 1;
|
||||
|
||||
|
||||
$res = $accounting->create($user);
|
||||
|
||||
|
||||
if ($res == 0) {
|
||||
} else {
|
||||
if ($res == - 3) {
|
||||
$error = 1;
|
||||
$_error = 1;
|
||||
$action = "create";
|
||||
}
|
||||
if ($res == - 4) {
|
||||
$error = 2;
|
||||
$_error = 2;
|
||||
$action = "create";
|
||||
}
|
||||
}
|
||||
@@ -85,22 +82,22 @@ else if ($action == 'edit')
|
||||
{
|
||||
if (! GETPOST('cancel', 'alpha')) {
|
||||
$result = $accounting->fetch($id);
|
||||
|
||||
|
||||
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
|
||||
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
|
||||
$result2 = $db->query($sql);
|
||||
$obj = $db->fetch_object($result2);
|
||||
|
||||
|
||||
$accounting->fk_pcg_version = $obj->pcg_version;
|
||||
$accounting->pcg_type = GETPOST('pcg_type');
|
||||
$accounting->pcg_subtype = GETPOST('pcg_subtype');
|
||||
$accounting->account_number = GETPOST('account_number');
|
||||
$accounting->account_number = GETPOST('account_number', 'int');
|
||||
$accounting->account_parent = GETPOST('account_parent', 'int');
|
||||
$accounting->label = GETPOST('label', 'alpha');
|
||||
|
||||
|
||||
$result = $accounting->update($user);
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||
exit();
|
||||
@@ -115,15 +112,15 @@ else if ($action == 'edit')
|
||||
else if ($action == 'delete')
|
||||
{
|
||||
$result = $accounting->fetch($id);
|
||||
|
||||
|
||||
if (! empty($accounting->id)) {
|
||||
$result = $accounting->delete($user);
|
||||
|
||||
|
||||
if ($result > 0) {
|
||||
Header("Location: account.php");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessage($accounting->error, 'errors');
|
||||
}
|
||||
@@ -131,6 +128,7 @@ else if ($action == 'delete')
|
||||
|
||||
/*
|
||||
* View
|
||||
*
|
||||
*/
|
||||
llxheader('', $langs->trans('AccountAccounting'));
|
||||
|
||||
@@ -140,15 +138,13 @@ $htmlacc = new FormVentilation($db);
|
||||
if ($action == 'create')
|
||||
{
|
||||
print_fiche_titre($langs->trans('NewAccount'));
|
||||
|
||||
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
|
||||
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
|
||||
print '<tr><td>' . $langs->trans("Label") . '</td>';
|
||||
@@ -165,45 +161,40 @@ if ($action == 'create')
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br><center><input class="button" type="submit" value="' . $langs->trans("Save") . '"> ';
|
||||
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '"></center';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else if ($id)
|
||||
{
|
||||
$rowid = $id;
|
||||
$account = $accounting->fetch($rowid);
|
||||
|
||||
|
||||
if ($account > 0) {
|
||||
dol_htmloutput_mesg($mesg);
|
||||
|
||||
|
||||
$head = accounting_prepare_head($accounting);
|
||||
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
if ($object->socid) {
|
||||
$soc->fetch($object->socid);
|
||||
}
|
||||
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
|
||||
|
||||
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="edit">';
|
||||
print '<input type="hidden" name="id" value="' . $id . '">';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
|
||||
print '<td><input name="account_number" size="30" value="' . $accounting->account_number . '"</td></tr>';
|
||||
print '<tr><td>' . $langs->trans("Label") . '</td>';
|
||||
@@ -220,81 +211,79 @@ else if ($id)
|
||||
print '<td>';
|
||||
print $htmlacc->select_pcgsubtype($accounting->pcg_subtype, 'pcg_subtype');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
|
||||
print '<br><center><input type="submit" class="button" value="' . $langs->trans("Save") . '"> ';
|
||||
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
print '</center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$linkback = '<a href="../admin/account.php">' . $langs->trans("BackToChartofaccounts") . '</a>';
|
||||
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Account number
|
||||
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
|
||||
print '<td>' . $accounting->account_number . '</td>';
|
||||
print '<td align="right" width="25%">' . $linkback . '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td>' . $langs->trans("Label") . '</td>';
|
||||
print '<td colspan="2">' . $accounting->label . '</td></tr>';
|
||||
|
||||
|
||||
$accp = new AccountingAccount($db);
|
||||
if (! empty($accounting->account_parent)) {
|
||||
$accp->fetch($accounting->account_parent, '');
|
||||
}
|
||||
print '<tr><td>' . $langs->trans("Accountparent") . '</td>';
|
||||
print '<td colspan="2">' . $accp->account_number . ' - ' . $accp->label . '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td>' . $langs->trans("Pcgtype") . '</td>';
|
||||
print '<td colspan="2">' . $accounting->pcg_type . '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
|
||||
print '<td colspan="2">' . $accounting->pcg_subtype . '</td></tr>';
|
||||
|
||||
print '<tr><td>' . $langs->trans("Activated") . '</td>';
|
||||
|
||||
print '<tr><td>' . $langs->trans("Active") . '</td>';
|
||||
print '<td colspan="2">';
|
||||
|
||||
|
||||
if (empty($accounting->active)) {
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
} else {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
}
|
||||
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
|
||||
if ($user->admin) {
|
||||
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Modify') . '</a>';
|
||||
}
|
||||
|
||||
|
||||
if ($user->admin) {
|
||||
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Delete') . '</a>';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
@@ -303,6 +292,6 @@ else if ($id)
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
|
||||
@@ -95,17 +94,16 @@ llxHeader();
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'title_setup');
|
||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup');
|
||||
|
||||
$head = admin_accounting_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
$var = true;
|
||||
|
||||
@@ -144,37 +142,33 @@ print "<br>\n";
|
||||
*/
|
||||
|
||||
$num = count($list);
|
||||
if ($num)
|
||||
{
|
||||
if ($num) {
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
||||
print "</tr>\n";
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
|
||||
|
||||
foreach ( $list as $key ) {
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr ' . $bc[$var] . ' class="value">';
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%">' . $label . '</td>';
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
foreach ( $list as $key ) {
|
||||
$var = ! $var;
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . dol_escape_htmltag($langs->trans('Modify')) . '" name="button"></div>';
|
||||
print '<tr ' . $bc[$var] . ' class="value">';
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%">' . $label . '</td>';
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div align="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@@ -176,8 +176,6 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Label
|
||||
@@ -201,14 +199,9 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></center';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
@@ -258,11 +251,9 @@ else if ($id)
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '</center>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -120,9 +120,6 @@ if ($result) {
|
||||
$i = 0;
|
||||
print_barre_liste($langs->trans("ImportAccount"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="action" value="import">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>' . $langs->trans("accountingaccount") . '</td>';
|
||||
print '<td>' . $langs->trans("label") . '</td>';
|
||||
@@ -135,6 +132,9 @@ if ($result) {
|
||||
$form = new Form($db);
|
||||
$htmlacc = new FormVentilation($db);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
print '<input type="hidden" name="action" value="import">';
|
||||
|
||||
$var = true;
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
@@ -164,7 +164,7 @@ if ($result) {
|
||||
|
||||
// Colonne choix ligne a ventiler
|
||||
|
||||
$checked = ('label' == 'O') ? ' checked' : '';
|
||||
$checked = ('label' == 'O') ? ' checked=checked' : '';
|
||||
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="mesCasesCochees[]" ' . $checked . ' value="' . $objp->accounting . '"/>';
|
||||
@@ -183,4 +183,4 @@ if ($result) {
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
|
||||
@@ -48,8 +47,6 @@ $action = GETPOST('action', 'alpha');
|
||||
// Other parameters ACCOUNTING_*
|
||||
$list = array (
|
||||
'ACCOUNTING_LIMIT_LIST_VENTILATION',
|
||||
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
|
||||
'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
|
||||
'ACCOUNTING_LENGTH_GACCOUNT',
|
||||
'ACCOUNTING_LENGTH_AACCOUNT',
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
@@ -58,8 +55,6 @@ $list = array (
|
||||
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
|
||||
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_VAT_BUY_ACCOUNT',
|
||||
'ACCOUNTING_VAT_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_ACCOUNT_SUSPENSE',
|
||||
'ACCOUNTING_ACCOUNT_TRANSFER_CASH'
|
||||
);
|
||||
@@ -153,17 +148,16 @@ llxHeader();
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'title_setup');
|
||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup');
|
||||
|
||||
$head = admin_accounting_prepare_head($accounting);
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Cas du parametre ACCOUNTING_MODE
|
||||
@@ -187,6 +181,7 @@ print '<td colspan="2">'.nl2br($langs->trans('OptionModeTrueDesc'));
|
||||
print "</td></tr>\n";
|
||||
print '<tr '.$bc[true].'><td width="200"><input type="radio" name="accounting_mode" value="CREANCES-DETTES"'.($accounting_mode == 'CREANCES-DETTES' ? ' checked' : '').'> '.$langs->trans('OptionModeVirtual').'</td>';
|
||||
print '<td colspan="2">'.nl2br($langs->trans('OptionModeVirtualDesc'))."</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@@ -226,7 +221,7 @@ if ($resql) {
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<option value="' . $row[0] . '"';
|
||||
print $conf->global->CHARTOFACCOUNTS == $row[0] ? ' selected' : '';
|
||||
print $conf->global->CHARTOFACCOUNTS == $row[0] ? ' selected="selected"' : '';
|
||||
print '>' . $row[1] . ' - ' . $row[3] . '</option>';
|
||||
|
||||
$i ++;
|
||||
@@ -290,13 +285,10 @@ if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
|
||||
print '</form>';
|
||||
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
|
||||
@@ -22,7 +21,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/journal.php
|
||||
* \file htdocs/accountancy/admin/journaux.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
@@ -48,8 +47,8 @@ $list = array (
|
||||
'ACCOUNTING_SELL_JOURNAL',
|
||||
'ACCOUNTING_PURCHASE_JOURNAL',
|
||||
'ACCOUNTING_SOCIAL_JOURNAL',
|
||||
'ACCOUNTING_MISCELLANEOUS_JOURNAL',
|
||||
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
|
||||
'ACCOUNTING_CASH_JOURNAL',
|
||||
'ACCOUNTING_MISCELLANEOUS_JOURNAL'
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -83,16 +82,16 @@ llxHeader();
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'title_setup');
|
||||
print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup');
|
||||
|
||||
$head = admin_accounting_prepare_head(null);
|
||||
|
||||
dol_fiche_head($head, 'journal', $langs->trans("Configuration"), 0, 'cron');
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
dol_fiche_head($head, 'journal', $langs->trans("Configuration"), 0, 'cron');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">' . $langs->trans('Journaux') . '</td>';
|
||||
@@ -113,11 +112,12 @@ foreach ( $list as $key ) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div style="text-align:center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<br />';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@@ -163,12 +163,10 @@ $db->free($resql);
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="button"></div>';
|
||||
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@@ -1,9 +1,8 @@
|
||||
<?PHP
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.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,369 +23,122 @@
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Onglet de gestion de parametrages des ventilations
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
// Dolibarr environment
|
||||
$res = @include ("../main.inc.php");
|
||||
if (! $res && file_exists("../main.inc.php"))
|
||||
$res = @include ("../main.inc.php");
|
||||
if (! $res && file_exists("../../main.inc.php"))
|
||||
$res = @include ("../../main.inc.php");
|
||||
if (! $res && file_exists("../../../main.inc.php"))
|
||||
$res = @include ("../../../main.inc.php");
|
||||
if (! $res)
|
||||
die("Include of main fails");
|
||||
|
||||
// Class
|
||||
dol_include_once("/core/lib/report.lib.php");
|
||||
dol_include_once("/core/lib/date.lib.php");
|
||||
dol_include_once("/product/class/product.class.php");
|
||||
|
||||
// Langs
|
||||
$langs->load("companies");
|
||||
$langs->load("compta");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
// search & action GETPOST
|
||||
$action = GETPOST('action');
|
||||
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
||||
$codeventil_sell = GETPOST('codeventil_sell', 'array');
|
||||
$chk_prod = GETPOST('chk_prod', 'array');
|
||||
$account_number_buy = GETPOST('account_number_buy');
|
||||
$account_number_sell = GETPOST('account_number_sell');
|
||||
$changeaccount = GETPOST('changeaccount', 'array');
|
||||
$changeaccount_buy = GETPOST('changeaccount_buy', 'array');
|
||||
$changeaccount_sell = GETPOST('changeaccount_sell', 'array');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
$btn_changeaccount = GETPOST('changeaccount');
|
||||
$btn_changetype = GETPOST('changetype');
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
// bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
// } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
|
||||
// $limit = $conf->liste_limit;
|
||||
} else {
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $sortfield)
|
||||
$sortfield = "p.ref";
|
||||
if (! $sortorder)
|
||||
$sortorder = "ASC";
|
||||
|
||||
// sales or purchase
|
||||
if ($action == 'update') {
|
||||
if (! empty($btn_changetype)) {
|
||||
$error = 0;
|
||||
|
||||
$accounting_product_modes = array (
|
||||
'ACCOUNTANCY_SELL',
|
||||
'ACCOUNTANCY_BUY'
|
||||
);
|
||||
|
||||
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
|
||||
if (in_array($accounting_product_mode, $accounting_product_modes)) {
|
||||
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($btn_changeaccount)) {
|
||||
$msg = '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||
if (! empty($chk_prod)) {
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
$msg .= '<div><font color="red">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
|
||||
|
||||
$cpt = 0;
|
||||
foreach ( $chk_prod as $productid ) {
|
||||
|
||||
$accounting_account_id=GETPOST('codeventil_'.$productid);
|
||||
|
||||
$result=$accounting->fetch($accounting_account_id,null,1);
|
||||
if ($result<0) {
|
||||
//setEventMessage(null, $accounting->errors,'errors');
|
||||
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
} else {
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "product";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql .= " SET accountancy_code_buy = " . $accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$sql .= " SET accountancy_code_sell = " . $accounting->account_number;
|
||||
}
|
||||
$sql .= " WHERE rowid = " . $productid;
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
$msg .= '<div><font color="green">' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
|
||||
} else {
|
||||
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $accounting->account_number . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
}
|
||||
}
|
||||
|
||||
$cpt ++;
|
||||
}
|
||||
} else {
|
||||
$msg .= '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
|
||||
}
|
||||
$msg .= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
// TODO after adding menu
|
||||
// if (! $user->rights->accounting->ventilation->dispatch)
|
||||
// accessforbidden();
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$form = new FormVentilation($db);
|
||||
|
||||
// Defaut AccountingAccount RowId Product / Service
|
||||
// at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
|
||||
// so we need to get those default value rowid first
|
||||
$accounting = new AccountingAccount($db);
|
||||
// TODO: we should need to check if result is a really exist accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||
$aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1);
|
||||
|
||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
}
|
||||
|
||||
// debug move header to top
|
||||
llxHeader('', $langs->trans("Accounts"));
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$form = new Form($db);
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = true;
|
||||
});
|
||||
});
|
||||
$(\'#unselect-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
print '<input type="button" class="button" style="float: right;" value="Renseigner les comptes comptables produits manquant" onclick="launch_export();" />';
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function launch_export() {
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
|
||||
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
|
||||
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
|
||||
}
|
||||
</script>';
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell as codesell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type , p.tosell , p.tobuy ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
|
||||
$sql .= " WHERE (";
|
||||
$sql .= " WHERE p.accountancy_code_sell IS NULL AND p.tosell = 1 OR p.accountancy_code_buy IS NULL AND p.tobuy = 1";
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||
$sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
|
||||
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL ";
|
||||
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||
}
|
||||
|
||||
$sql .= ")";
|
||||
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND (p.ref like '" . $search_ref . "%')";
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND (p.label like '" . $search_label . "%')";
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (p.description like '%" . $search_desc . "%')";
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
dol_syslog('accountancy/admin/productaccount.php:: $sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
* view
|
||||
*/
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('OptionMode') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr ' . $bc[false] . '><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode != 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('Accountancy_code_sell') . '</td>';
|
||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductSell'));
|
||||
print "</td></tr>\n";
|
||||
print '<tr ' . $bc[true] . '><td width="200"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('Accountancy_code_buy') . '</td>';
|
||||
print '<td colspan="2">' . nl2br($langs->trans('OptionModeProductBuy')) . "</td></tr>\n";
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div style="text-align:center"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="changetype"></div>';
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
if (! empty($msg)) {
|
||||
print $msg;
|
||||
}
|
||||
|
||||
// print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td> ';
|
||||
// print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "p.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print ' ';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
|
||||
} else {
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
||||
print '<th align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
||||
}
|
||||
// print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label> / <label id="unselect-all">' . $langs->trans('None') . '</label>');
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
|
||||
print '<td class="liste_titre" colspan="2"> </td>';
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<td align="left">' . $langs->trans("Ref") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Label") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Description") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
|
||||
|
||||
$var = true;
|
||||
|
||||
while ( $i < min($num_lines, 250) ) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
while ( $i < min($num, 250) ) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var = ! $var;
|
||||
|
||||
|
||||
$compta_prodsell = $obj->accountancy_code_sell;
|
||||
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
} else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
if (empty($compta_prodsell)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
else
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
}
|
||||
|
||||
|
||||
$compta_prodbuy = $obj->accountancy_code_buy;
|
||||
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
} else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
if (empty($compta_prodbuy)) {
|
||||
if ($obj->product_type == 0)
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
else
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
}
|
||||
|
||||
|
||||
$product_static = new Product($db);
|
||||
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print "</tr>";
|
||||
print "<tr $bc[$var]>";
|
||||
// Ref produit as link
|
||||
$product_static->ref = $obj->ref;
|
||||
$product_static->id = $obj->rowid;
|
||||
$product_static->type = $obj->type;
|
||||
// Ref produit
|
||||
$product_static->ref = $objp->ref;
|
||||
$product_static->id = $objp->rowid;
|
||||
$product_static->type = $objp->type;
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
else
|
||||
print '- ';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
print '<td align="left">' . dol_trunc($obj->label, 24) . '</td>';
|
||||
// TODO ADJUST DESCRIPTION SIZE
|
||||
// print '<td align="left">' . $obj->description . '</td>';
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||
|
||||
// acountingaccount buy
|
||||
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
|
||||
// TODO: replace by select
|
||||
// print '<td align="left">' . $compta_prodbuy . '</td>';
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
print '<td align="left">';
|
||||
print $form->select_account($compta_prodbuy_id, 'codeventil_'.$product_static->id, 1);
|
||||
print '</td>';
|
||||
} else {
|
||||
|
||||
// acountingaccount sel
|
||||
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
||||
// TODO: replace by select
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
// $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
print '<td align="left">';
|
||||
print $form->select_account($compta_prodsell_id, 'codeventil_'.$product_static->id, 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Checkbox select
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
print '<td align="left">' . $obj->ref . '</td>';
|
||||
print '<td align="left">' . $obj->label . '</td>';
|
||||
print '<td align="left">' . $obj->description . '</td>';
|
||||
|
||||
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
|
||||
print '<td align="left">' . $compta_prodbuy . '</td>';
|
||||
|
||||
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
|
||||
print '<td align="left">' . $compta_prodsell . '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Change_Account") . '"></div>';
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@@ -18,23 +18,23 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/card.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page to show account
|
||||
* \file htdocs/accountancy/bookkeeping/card.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page to show account
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("accountancy");
|
||||
$langs->load("accounting");
|
||||
|
||||
// Security check
|
||||
$id = GETPOST('id', 'int');
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
$action = GETPOST('action');
|
||||
$piece_num = GETPOST("piece_num");
|
||||
@@ -48,132 +48,132 @@ $debit = price2num(GETPOST('debit'));
|
||||
$credit = price2num(GETPOST('credit'));
|
||||
|
||||
if ($action == "confirm_update") {
|
||||
|
||||
$error = 0;
|
||||
|
||||
if ((intval($debit) != 0) && (intval($credit) != 0)) {
|
||||
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$result = $book->fetch($id);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
$book->numero_compte = $numero_compte;
|
||||
$book->code_tiers = $code_tiers;
|
||||
$book->label_compte = $label_compte;
|
||||
$book->debit = $debit;
|
||||
$book->credit = $credit;
|
||||
|
||||
if (! empty($debit)) {
|
||||
$book->montant = $debit;
|
||||
$book->sens = 'D';
|
||||
}
|
||||
if (! empty($credit)) {
|
||||
$book->montant = $credit;
|
||||
$book->sens = 'C';
|
||||
}
|
||||
|
||||
$result = $book->update();
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessage($langs->trans('Saved'), 'mesgs');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
if ((intval($debit) != 0) && (intval($credit) != 0)) {
|
||||
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$result = $book->fetch($id);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
$book->numero_compte = $numero_compte;
|
||||
$book->code_tiers = $code_tiers;
|
||||
$book->label_compte = $label_compte;
|
||||
$book->debit = $debit;
|
||||
$book->credit = $credit;
|
||||
|
||||
if (! empty($debit)) {
|
||||
$book->montant = $debit;
|
||||
$book->sens = 'D';
|
||||
}
|
||||
if (! empty($credit)) {
|
||||
$book->montant = $credit;
|
||||
$book->sens = 'C';
|
||||
}
|
||||
|
||||
$result = $book->update();
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessage($langs->trans('Saved'), 'mesgs');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == "add") {
|
||||
$error = 0;
|
||||
|
||||
if ((intval($debit) != 0) && (intval($credit) != 0)) {
|
||||
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$book->numero_compte = $numero_compte;
|
||||
$book->code_tiers = $code_tiers;
|
||||
$book->label_compte = $label_compte;
|
||||
$book->debit = $debit;
|
||||
$book->credit = $credit;
|
||||
$book->doc_date = GETPOST('doc_date');
|
||||
$book->doc_type = GETPOST('doc_type');
|
||||
$book->piece_num = $piece_num;
|
||||
$book->doc_ref = GETPOST('doc_ref');
|
||||
$book->code_journal = GETPOST('code_journal');
|
||||
$book->fk_doc = GETPOST('fk_doc');
|
||||
$book->fk_docdet = GETPOST('fk_docdet');
|
||||
|
||||
if (! empty($debit)) {
|
||||
$book->montant = $debit;
|
||||
$book->sens = 'D';
|
||||
}
|
||||
if (! empty($credit)) {
|
||||
$book->montant = $credit;
|
||||
$book->sens = 'C';
|
||||
}
|
||||
|
||||
$result = $book->create_std($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessage($langs->trans('Saved'), 'mesgs');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
if ((intval($debit) != 0) && (intval($credit) != 0)) {
|
||||
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
|
||||
$error ++;
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$book->numero_compte = $numero_compte;
|
||||
$book->code_tiers = $code_tiers;
|
||||
$book->label_compte = $label_compte;
|
||||
$book->debit = $debit;
|
||||
$book->credit = $credit;
|
||||
$book->doc_date = GETPOST('doc_date');
|
||||
$book->doc_type = GETPOST('doc_type');
|
||||
$book->piece_num = $piece_num;
|
||||
$book->doc_ref = GETPOST('doc_ref');
|
||||
$book->code_journal = GETPOST('code_journal');
|
||||
$book->fk_doc = GETPOST('fk_doc');
|
||||
$book->fk_docdet = GETPOST('fk_docdet');
|
||||
|
||||
if (! empty($debit)) {
|
||||
$book->montant = $debit;
|
||||
$book->sens = 'D';
|
||||
}
|
||||
if (! empty($credit)) {
|
||||
$book->montant = $credit;
|
||||
$book->sens = 'C';
|
||||
}
|
||||
|
||||
$result = $book->create_std($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessage($langs->trans('Saved'), 'mesgs');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == "confirm_delete") {
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$result = $book->fetch($id);
|
||||
|
||||
$piece_num = $book->piece_num;
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
$result = $book->delete($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$result = $book->fetch($id);
|
||||
|
||||
$piece_num = $book->piece_num;
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
$result = $book->delete($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
else if ($action == "confirm_create") {
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$book->label_compte = '';
|
||||
$book->debit = 0;
|
||||
$book->credit = 0;
|
||||
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
|
||||
$book->doc_type = GETPOST('doc_type');
|
||||
$book->piece_num = GETPOST('next_num_mvt');
|
||||
$book->doc_ref = GETPOST('doc_ref');
|
||||
$book->code_journal = GETPOST('code_journal');
|
||||
$book->fk_doc = 0;
|
||||
$book->fk_docdet = 0;
|
||||
|
||||
$book->montant = 0;
|
||||
|
||||
$result = $book->create_std($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessage($langs->trans('Saved'), 'mesgs');
|
||||
$action = '';
|
||||
$piece_num = $book->piece_num;
|
||||
}
|
||||
$book = new BookKeeping($db);
|
||||
|
||||
$book->label_compte = '';
|
||||
$book->debit = 0;
|
||||
$book->credit = 0;
|
||||
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
|
||||
$book->doc_type = GETPOST('doc_type');
|
||||
$book->piece_num = GETPOST('next_num_mvt');
|
||||
$book->doc_ref = GETPOST('doc_ref');
|
||||
$book->code_journal = GETPOST('code_journal');
|
||||
$book->fk_doc = 0;
|
||||
$book->fk_docdet = 0;
|
||||
|
||||
$book->montant = 0;
|
||||
|
||||
$result = $book->create_std($user);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
setEventMessage($langs->trans('Saved'), 'mesgs');
|
||||
$action = '';
|
||||
$piece_num = $book->piece_num;
|
||||
}
|
||||
}
|
||||
|
||||
llxHeader();
|
||||
@@ -181,194 +181,190 @@ llxHeader();
|
||||
$html = new Form($db);
|
||||
|
||||
/*
|
||||
* Confirmation to delete the command
|
||||
* Confirmation to delete the command
|
||||
*/
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
|
||||
if ($action == 'create') {
|
||||
print_fiche_titre($langs->trans("CreateMvts"));
|
||||
|
||||
$code_journal_array = array (
|
||||
$conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
|
||||
$conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
|
||||
$conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL,
|
||||
$conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL,
|
||||
$conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL
|
||||
);
|
||||
|
||||
$book = new BookKeeping($db);
|
||||
$next_num_mvt = $book->getNextNumMvt();
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
|
||||
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
|
||||
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("NumMvts") . '</td>';
|
||||
print '<td>' . $next_num_mvt . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Docdate") . '</td>';
|
||||
print '<td>';
|
||||
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Codejournal") . '</td>';
|
||||
|
||||
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Docref") . '</td>';
|
||||
print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
|
||||
print '</tr>';
|
||||
print '<tr>';
|
||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||
print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans("Create") . '">';
|
||||
print ' <input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
$book = new BookKeeping($db);
|
||||
$result = $book->fetch_per_mvt($piece_num);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
}
|
||||
if (! empty($book->piece_num)) {
|
||||
|
||||
print_fiche_titre($langs->trans("UpdateMvts"));
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("NumMvts") . '</td>';
|
||||
print '<td>' . $book->piece_num . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="impair">';
|
||||
print '<td>' . $langs->trans("Docdate") . '</td>';
|
||||
print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("Codejournal") . '</td>';
|
||||
print '<td>' . $book->code_journal . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="impair">';
|
||||
print '<td>' . $langs->trans("Docref") . '</td>';
|
||||
print '<td>' . $book->doc_ref . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||
print '<td>' . $book->doc_type . '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
$result = $book->fetch_all_per_mvt($piece_num);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
|
||||
print_fiche_titre($langs->trans("ListeMvts"));
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
if (count($book->linesmvt) > 0) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("Numerocompte"));
|
||||
print_liste_field_titre($langs->trans("Code_tiers"));
|
||||
print_liste_field_titre($langs->trans("Labelcompte"));
|
||||
print_liste_field_titre($langs->trans("Debit"));
|
||||
print_liste_field_titre($langs->trans("Credit"));
|
||||
print_liste_field_titre($langs->trans("Amount"));
|
||||
print_liste_field_titre($langs->trans("Sens"));
|
||||
print_liste_field_titre('');
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ( $book->linesmvt as $line ) {
|
||||
$var = ! $var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
if ($action == 'update' && $line->id == $id) {
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
||||
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
||||
print '<input type="hidden" name="action" value="confirm_update">' . "\n";
|
||||
print '<td><input type="text" size="6" name="numero_compte" value="' . $line->numero_compte . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="code_tiers" value="' . $line->code_tiers . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||
print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
|
||||
print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
|
||||
print '<td>' . $line->montant . '</td>';
|
||||
print '<td>' . $line->sens . '</td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">';
|
||||
print '</form>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>' . $line->numero_compte . '</td>';
|
||||
print '<td>' . $line->code_tiers . '</td>';
|
||||
print '<td>' . $line->label_compte . '</td>';
|
||||
print '<td>' . $line->debit . '</td>';
|
||||
print '<td>' . $line->credit . '</td>';
|
||||
print '<td>' . $line->montant . '</td>';
|
||||
print '<td>' . $line->sens . '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ';
|
||||
print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if ($action == "" || $action == 'add') {
|
||||
$var = ! $var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">' . "\n";
|
||||
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
|
||||
print '<input type="hidden" name="doc_type" value="' . $book->doc_type . '">' . "\n";
|
||||
print '<input type="hidden" name="doc_ref" value="' . $book->doc_ref . '">' . "\n";
|
||||
print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n";
|
||||
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
|
||||
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
|
||||
print '<td><input type="text" size="6" name="numero_compte" value="' . $numero_compte . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="code_tiers" value="' . $code_tiers . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
|
||||
print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
|
||||
print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print_fiche_titre($langs->trans("NoRecords"));
|
||||
}
|
||||
|
||||
print_fiche_titre($langs->trans("CreateMvts"));
|
||||
|
||||
$code_journal_array = array (
|
||||
$conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
|
||||
$conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
|
||||
$conf->global->ACCOUNTING_BANK_JOURNAL => $conf->global->ACCOUNTING_BANK_JOURNAL,
|
||||
$conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL
|
||||
);
|
||||
|
||||
$book = new BookKeeping($db);
|
||||
$next_num_mvt = $book->getNextNumMvt();
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
|
||||
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
|
||||
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("NumMvts") . '</td>';
|
||||
print '<td>' . $next_num_mvt . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="impair">';
|
||||
print '<td>' . $langs->trans("Docdate") . '</td>';
|
||||
print '<td>';
|
||||
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("Codejournal") . '</td>';
|
||||
|
||||
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="impair">';
|
||||
print '<td>' . $langs->trans("Docref") . '</td>';
|
||||
print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||
print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
print '<input type="submit" class="butAction" value="' . $langs->trans("Save") . '">';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$book = new BookKeeping($db);
|
||||
$result = $book->fetch_per_mvt($piece_num);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
}
|
||||
if (! empty($book->piece_num)) {
|
||||
|
||||
print_fiche_titre($langs->trans("UpdateMvts"));
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("NumMvts") . '</td>';
|
||||
print '<td>' . $book->piece_num . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="impair">';
|
||||
print '<td>' . $langs->trans("Docdate") . '</td>';
|
||||
print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("Codejournal") . '</td>';
|
||||
print '<td>' . $book->code_journal . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="impair">';
|
||||
print '<td>' . $langs->trans("Docref") . '</td>';
|
||||
print '<td>' . $book->doc_ref . '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="pair">';
|
||||
print '<td>' . $langs->trans("Doctype") . '</td>';
|
||||
print '<td>' . $book->doc_type . '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
$result = $book->fetch_all_per_mvt($piece_num);
|
||||
if ($result < 0) {
|
||||
setEventMessage($book->errors, 'errors');
|
||||
} else {
|
||||
|
||||
print_fiche_titre($langs->trans("ListeMvts"));
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
if (count($book->linesmvt) > 0) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("Numerocompte"));
|
||||
print_liste_field_titre($langs->trans("Code_tiers"));
|
||||
print_liste_field_titre($langs->trans("Labelcompte"));
|
||||
print_liste_field_titre($langs->trans("Debit"));
|
||||
print_liste_field_titre($langs->trans("Credit"));
|
||||
print_liste_field_titre($langs->trans("Amount"));
|
||||
print_liste_field_titre($langs->trans("Sens"));
|
||||
|
||||
print '<td></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ( $book->linesmvt as $line ) {
|
||||
$var = ! $var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
if ($action == 'update' && $line->id == $id) {
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
||||
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
|
||||
print '<input type="hidden" name="action" value="confirm_update">' . "\n";
|
||||
print '<td><input type="text" size="6" name="numero_compte" value="' . $line->numero_compte . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="code_tiers" value="' . $line->code_tiers . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
|
||||
print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
|
||||
print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
|
||||
print '<td>' . $line->montant . '</td>';
|
||||
print '<td>' . $line->sens . '</td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">';
|
||||
print '</form>';
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td>' . $line->numero_compte . '</td>';
|
||||
print '<td>' . $line->code_tiers . '</td>';
|
||||
print '<td>' . $line->label_compte . '</td>';
|
||||
print '<td>' . $line->debit . '</td>';
|
||||
print '<td>' . $line->credit . '</td>';
|
||||
print '<td>' . $line->montant . '</td>';
|
||||
print '<td>' . $line->sens . '</td>';
|
||||
|
||||
print '<td>';
|
||||
print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
|
||||
print img_edit();
|
||||
print '</a> ';
|
||||
print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
if ($action == "" || $action == 'add') {
|
||||
$var = ! $var;
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">' . "\n";
|
||||
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
|
||||
print '<input type="hidden" name="doc_type" value="' . $book->doc_type . '">' . "\n";
|
||||
print '<input type="hidden" name="doc_ref" value="' . $book->doc_ref . '">' . "\n";
|
||||
print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n";
|
||||
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
|
||||
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
|
||||
print '<td><input type="text" size="6" name="numero_compte" value="' . $numero_compte . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="code_tiers" value="' . $code_tiers . '"/></td>';
|
||||
print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
|
||||
print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
|
||||
print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print "</table>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
print_fiche_titre($langs->trans("NoRecords"));
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@@ -31,8 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("accountancy");
|
||||
|
||||
$page = GETPOST("page");
|
||||
$sortorder = GETPOST("sortorder");
|
||||
@@ -157,6 +155,8 @@ else {
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<a href="./card.php?action=create" class="butAction">' . $langs->trans("NewAccountingMvt") . '</a></div>';
|
||||
|
||||
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="export_csv">';
|
||||
@@ -209,7 +209,7 @@ else {
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
print '<td>' . $obj->doc_type . '</td>';
|
||||
print '<td align="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . length_accountg($obj->numero_compte) . '</td>';
|
||||
print '<td>' . length_accounta($obj->code_tiers) . '</td>';
|
||||
@@ -224,11 +224,6 @@ else {
|
||||
$i ++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="./card.php?action=create">'.$langs->trans("NewAccountingMvt").'</a>';
|
||||
print '</div>';
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -90,7 +90,7 @@ if ($resql) {
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "bk.code_journal", "", "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre(" ");
|
||||
print "</tr>\n";
|
||||
|
||||
$var = True;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.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
|
||||
@@ -28,7 +27,7 @@
|
||||
/**
|
||||
* Class to manage accounting accounts
|
||||
*/
|
||||
class AccountingAccount extends CommonObject
|
||||
class AccountingAccount
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
@@ -61,16 +60,14 @@ class AccountingAccount extends CommonObject
|
||||
/**
|
||||
* Load record in memory
|
||||
*
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @param int $limittocurentchart 1=Do not load record if it is into another accounting system
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($rowid = null, $account_number = null, $limittocurentchart=0)
|
||||
function fetch($rowid = null, $account_number = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($rowid || $account_number) {
|
||||
if ($rowid || $account_number)
|
||||
{
|
||||
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
|
||||
if ($rowid) {
|
||||
@@ -78,15 +75,15 @@ class AccountingAccount extends CommonObject
|
||||
} elseif ($account_number) {
|
||||
$sql .= " account_number = '" . $account_number . "'";
|
||||
}
|
||||
if (!empty($limittocurentchart)) {
|
||||
$sql .=' AND fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')';
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
if ($obj) {
|
||||
if ($obj)
|
||||
{
|
||||
$this->id = $obj->rowid;
|
||||
$this->rowid = $obj->rowid;
|
||||
$this->datec = $obj->datec;
|
||||
@@ -102,14 +99,18 @@ class AccountingAccount extends CommonObject
|
||||
$this->active = $obj->active;
|
||||
|
||||
return $this->id;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->error="Error " . $this->db->lasterror();
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -124,7 +125,8 @@ class AccountingAccount extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
$now = dol_now();
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->fk_pcg_version))
|
||||
@@ -341,31 +343,6 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return clicable name (with picto eventually)
|
||||
*
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?id='.$this->id.'">';
|
||||
$linkend='</a>';
|
||||
|
||||
$picto='billr';
|
||||
|
||||
$label=$langs->trans("Show").': '.$this->account_number.' - '.$this->label;
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($label,$picto).$linkend);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$link.$this->account_number.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information on record
|
||||
*
|
||||
@@ -462,4 +439,4 @@ class AccountingAccount extends CommonObject
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@
|
||||
/**
|
||||
* Class to manage accountancy book keeping
|
||||
*/
|
||||
class BookKeeping extends CommonObject
|
||||
class BookKeeping
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
@@ -735,4 +735,4 @@ class BookKeepingLine
|
||||
var $fk_user_author;
|
||||
var $code_journal;
|
||||
var $piece_num;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@@ -67,7 +66,7 @@ class FormVentilation extends Form
|
||||
|
||||
$selected = '';
|
||||
if ($selectedkey == $obj->import_key) {
|
||||
$selected = ' selected ';
|
||||
$selected = ' selected="selected" ';
|
||||
}
|
||||
|
||||
$out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . $obj->import_key . '</OPTION>';
|
||||
@@ -92,13 +91,10 @@ class FormVentilation extends Form
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
* @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param int $aabase set accountingaccount base class to display empty=all or from 1 to 8 will display only account beginning by
|
||||
*
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array())
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@@ -120,26 +116,21 @@ class FormVentilation extends Form
|
||||
if ($showempty)
|
||||
$out .= '<option value="-1"></option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : '50';
|
||||
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$label = $obj->account_number . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
if ($select_in == 0 ) $select_value_in = $obj->rowid;
|
||||
if ($select_in == 1 ) $select_value_in = $obj->account_number;
|
||||
if ($select_out == 0 ) $select_value_out = $obj->rowid;
|
||||
if ($select_out == 1 ) $select_value_out = $obj->account_number;
|
||||
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accountingaccount and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if (($selectid != '') && $selectid == $select_value_in) {
|
||||
// $out .= '<option value="' . $obj->account_number . '" selected>' . $label . '</option>';
|
||||
$out .= '<option value="' . $select_value_out . '" selected>' . $label . '</option>';
|
||||
if (($selectid != '') && $selectid == $obj->rowid) {
|
||||
// $out .= '<option value="' . $obj->account_number . '" selected="selected">' . $label . '</option>';
|
||||
$out .= '<option value="' . $obj->rowid . '" selected="selected">' . $label . '</option>';
|
||||
} else {
|
||||
// $out .= '<option value="' . $obj->account_number . '">' . $label . '</option>';
|
||||
$out .= '<option value="' . $select_value_out . '">' . $label . '</option>';
|
||||
$out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
@@ -193,7 +184,7 @@ class FormVentilation extends Form
|
||||
$label = $obj->pcg_type;
|
||||
|
||||
if (($selectid != '') && $selectid == $obj->pcg_type) {
|
||||
$out .= '<option value="' . $obj->pcg_type . '" selected>' . $label . '</option>';
|
||||
$out .= '<option value="' . $obj->pcg_type . '" selected="selected">' . $label . '</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $obj->pcg_type . '">' . $label . '</option>';
|
||||
}
|
||||
@@ -249,7 +240,7 @@ class FormVentilation extends Form
|
||||
$label = $obj->pcg_subtype;
|
||||
|
||||
if (($selectid != '') && $selectid == $obj->pcg_subtype) {
|
||||
$out .= '<option value="' . $obj->pcg_subtype . '" selected>' . $label . '</option>';
|
||||
$out .= '<option value="' . $obj->pcg_subtype . '" selected="selected">' . $label . '</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $obj->pcg_subtype . '">' . $label . '</option>';
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?PHP
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@@ -19,12 +19,12 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/card.php
|
||||
* \ingroup Accounting Expert
|
||||
* \ingroup Accountancy
|
||||
* \brief Card customer ventilation
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
@@ -40,17 +40,18 @@ $id = GETPOST('id');
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
|
||||
if (! GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " SET fk_code_ventilation = " . $codeventil;
|
||||
$sql .= " WHERE rowid = " . $id;
|
||||
|
||||
|
||||
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql) {
|
||||
@@ -59,13 +60,9 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
|
||||
} else {
|
||||
header("Location: ./lines.php");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader("", "", "FicheVentilation");
|
||||
|
||||
if ($cancel == $langs->trans("Cancel")) {
|
||||
@@ -87,55 +84,55 @@ if (! empty($id)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = l.fk_facture";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
|
||||
|
||||
$sql .= " WHERE f.fk_statut > 0";
|
||||
$sql .= " AND l.rowid = " . $id;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
|
||||
dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
|
||||
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
if ($num_lines) {
|
||||
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
|
||||
print_fiche_titre($langs->trans('CustomersVentilation'),'','title_setup');
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>';
|
||||
print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'setup');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Ref facture
|
||||
print '<tr><td>' . $langs->trans("Invoice") . '</td>';
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->facid;
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
print '<tr><td width="20%">' . $langs->trans("Line") . '</td>';
|
||||
print '<td>' . nl2br($objp->description) . '</td></tr>';
|
||||
print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>';
|
||||
print $objp->account_number . '-' . $objp->label;
|
||||
print '<tr><td width="20%">' . $langs->trans("NewAccount") . '</td><td>';
|
||||
print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
print '<br><div align="center"><input class="button" type="submit" value="' . $langs->trans("Save") . '"> ';
|
||||
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
print "Error";
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
|
||||
@@ -159,7 +158,7 @@ $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY fd.fk_code_ventilation";
|
||||
@@ -172,8 +171,8 @@ if ($resql) {
|
||||
|
||||
while ( $i < $num ) {
|
||||
$row = $db->fetch_row($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>' . length_accountg($row[0]) . '</td>';
|
||||
|
||||
print '<tr><td>' . length_accountg($row[0]) . '</td>';
|
||||
print '<td align="left">' . $row[1] . '</td>';
|
||||
print '<td align="right">' . price($row[2]) . '</td>';
|
||||
print '<td align="right">' . price($row[3]) . '</td>';
|
||||
@@ -234,7 +233,7 @@ $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
|
||||
@@ -307,7 +306,7 @@ if (! empty($conf->margin->enabled)) {
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@@ -27,54 +27,19 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
// Langs
|
||||
// langs
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$account_parent = GETPOST('account_parent');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
//Search Getpost
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_invoice = GETPOST('search_invoice','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_desc = GETPOST('search_desc','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
$search_account = GETPOST('search_account','alpha');
|
||||
$search_vat = GETPOST('search_vat','alpha');
|
||||
|
||||
//Getpost Order and column and limit page
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page < 0) $page = 0;
|
||||
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
|
||||
$limit = $conf->liste_limit;
|
||||
} else {
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
|
||||
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
|
||||
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
$sortorder = " DESC ";
|
||||
}
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
@@ -84,19 +49,13 @@ if (! $user->rights->accounting->ventilation->dispatch)
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref='';
|
||||
$search_invoice='';
|
||||
$search_label='';
|
||||
$search_desc='';
|
||||
$search_amount='';
|
||||
$search_account='';
|
||||
$search_vat='';
|
||||
}
|
||||
// change account
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
|
||||
$is_search = GETPOST('button_search_x');
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && empty($is_search)) {
|
||||
$error = 0;
|
||||
|
||||
$db->begin();
|
||||
@@ -126,31 +85,20 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
|
||||
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = true;
|
||||
});
|
||||
});
|
||||
$(\'#unselect-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$page = GETPOST("page");
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
} elseif ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
|
||||
$limit = $conf->liste_limit;
|
||||
} else {
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
|
||||
$offset = $limit * $page;
|
||||
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT l.rowid , f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.qty, l.tva_tx, l.fk_code_ventilation, aa.label, aa.account_number,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
@@ -159,33 +107,31 @@ $sql .= " , " . MAIN_DB_PREFIX . "facturedet as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql .= " AND aa.rowid = l.fk_code_ventilation";
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= " AND f.facnumber like '%" . $search_invoice . "%'";
|
||||
if (strlen(trim(GETPOST("search_facture")))) {
|
||||
$sql .= " AND f.facnumber like '%" . GETPOST("search_facture") . "%'";
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND p.ref like '%" . $search_ref . "%'";
|
||||
if (strlen(trim(GETPOST("search_ref")))) {
|
||||
$sql .= " AND p.ref like '%" . GETPOST("search_ref") . "%'";
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND p.label like '%" . $search_label . "%'";
|
||||
if (strlen(trim(GETPOST("search_label")))) {
|
||||
$sql .= " AND p.label like '%" . GETPOST("search_label") . "%'";
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND l.description like '%" . $search_desc . "%'";
|
||||
if (strlen(trim(GETPOST("search_desc")))) {
|
||||
$sql .= " AND l.description like '%" . GETPOST("search_desc") . "%'";
|
||||
}
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND l.total_ht like '%" . $search_amount . "%'";
|
||||
}
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
}
|
||||
if (strlen(trim($search_vat)))
|
||||
{
|
||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||
if (strlen(trim(GETPOST("search_account")))) {
|
||||
$sql .= " AND aa.account_number like '%" . GETPOST("search_account") . "%'";
|
||||
}
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->plimit($limit + 1,$offset);
|
||||
|
||||
$sql .= " ORDER BY l.rowid";
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
|
||||
$sql .= " DESC ";
|
||||
}
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("/accountancy/customer/lines.php sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@@ -193,6 +139,7 @@ if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
|
||||
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
|
||||
print '<td align="left"><b>' . $langs->trans("DescVentilDoneCustomer") . '</b></td>';
|
||||
@@ -200,35 +147,32 @@ if ($result) {
|
||||
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
||||
print '<br><br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount");
|
||||
print $formventilation->select_account($account_parent, 'account_parent', 1);
|
||||
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '"/></div>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Ventilate").'<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
|
||||
print '<tr class="liste_titre"><td>' . $langs->trans("Invoice") . '</td>';
|
||||
print '<td>' . $langs->trans("Ref") . '</td>';
|
||||
print '<td>' . $langs->trans("Label") . '</td>';
|
||||
print '<td>' . $langs->trans("Description") . '</td>';
|
||||
print '<td align="left">' . $langs->trans("Amount") . '</td>';
|
||||
print '<td colspan="2" align="left">' . $langs->trans("Account") . '</td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="' . GETPOST("search_facture") . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . GETPOST("search_ref") . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . GETPOST("search_label") . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . GETPOST("search_desc") . '"></td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . GETPOST("search_account") . '"></td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/search.png" alt="' . $langs->trans("Search") . '">';
|
||||
print '</td>';
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount. '"></td>';
|
||||
print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre" colspan="2"> </td>';
|
||||
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
$facture_static = new Facture($db);
|
||||
$product_static = new Product($db);
|
||||
@@ -236,16 +180,16 @@ if ($result) {
|
||||
$var = True;
|
||||
while ( $objp = $db->fetch_object($result) ) {
|
||||
$var = ! $var;
|
||||
$codecompta = $objp->account_number . ' ' . $objp->label;
|
||||
$codeCompta = $objp->account_number . ' ' . $objp->label;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Ref Invoice
|
||||
// Ref facture
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->facid;
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
|
||||
// Ref Product
|
||||
// Ref produit
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
@@ -258,11 +202,10 @@ if ($result) {
|
||||
|
||||
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . $codecompta . '</td>';
|
||||
print '<td align="right">' . $objp->rowid . '</td>';
|
||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print '<td align="left">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="left">' . $codeCompta . '</td>';
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
print '<td><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
@@ -278,4 +221,4 @@ if ($result) {
|
||||
print "</table></form>";
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
@@ -21,65 +21,27 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/list.php
|
||||
* \ingroup Accounting Expert
|
||||
* \ingroup Accountancy
|
||||
* \brief Ventilation page from customers invoices
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$action = GETPOST('action');
|
||||
|
||||
// Select Box
|
||||
$codeventil = GETPOST('codeventil', 'array');
|
||||
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
|
||||
|
||||
// Search Getpost
|
||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$btn_ventil = GETPOST('ventil', 'alpha');
|
||||
|
||||
// Getpost Order and column and limit page
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
|
||||
$limit = $conf->liste_limit;
|
||||
} else {
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
if (! $sortfield)
|
||||
$sortfield = "f.datef, f.facnumber, l.rowid";
|
||||
|
||||
if (! $sortorder) {
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||
$sortorder = " DESC ";
|
||||
}
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
@@ -88,28 +50,9 @@ if (! $user->rights->accounting->ventilation->dispatch)
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
|
||||
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
|
||||
$search_ref = '';
|
||||
$search_invoice = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Ventilation"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
@@ -125,34 +68,34 @@ print '<script type="text/javascript">
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
/*
|
||||
* Action
|
||||
*/
|
||||
|
||||
if ($action == 'ventil' && !empty($btn_ventil)) {
|
||||
if ($action == 'ventil') {
|
||||
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
|
||||
if (! empty($codeventil) && ! empty($mesCasesCochees)) {
|
||||
print '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
|
||||
$mesCodesVentilChoisis = $codeventil;
|
||||
$cpt = 0;
|
||||
foreach ( $mesCasesCochees as $maLigneCochee ) {
|
||||
// print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>";
|
||||
$maLigneCourante = explode("_", $maLigneCochee);
|
||||
$monId = $maLigneCourante[0];
|
||||
$monNumLigne = $maLigneCourante[1];
|
||||
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
|
||||
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql .= " SET fk_code_ventilation = " . $monCompte;
|
||||
$sql .= " WHERE rowid = " . $monId;
|
||||
|
||||
|
||||
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
||||
if ($db->query($sql)) {
|
||||
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
|
||||
} else {
|
||||
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
|
||||
}
|
||||
|
||||
|
||||
$cpt ++;
|
||||
}
|
||||
} else {
|
||||
@@ -164,48 +107,40 @@ if ($action == 'ventil' && !empty($btn_ventil)) {
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$page = GETPOST('page');
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, f.datef, f.type as ftype, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod";
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
|
||||
$limit = $conf->liste_limit;
|
||||
} else {
|
||||
$limit = $conf->liste_limit;
|
||||
}
|
||||
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation, l.product_type,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell";
|
||||
$sql .= " , aa.rowid as aarowid";
|
||||
$sql .= " , l.product_type as type_l, l.tva_tx as tva_tx_line";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountancy_code_sell = aa.account_number";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
|
||||
$sql .= " WHERE f.fk_statut > 0";
|
||||
$sql. = " AND fk_code_ventilation <= 0";
|
||||
$sql. = " AND product_type <= 2";
|
||||
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
|
||||
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= " AND (f.facnumber like '%" . $search_invoice . "%')";
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND (p.label like '%" . $search_label . "%')";
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (l.description like '%" . $search_desc . "%')";
|
||||
}
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND l.total_ht like '" . $search_amount . "%'";
|
||||
}
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
}
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
|
||||
}
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
}
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$sql .= " ORDER BY l.rowid";
|
||||
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
|
||||
$sql .= " DESC ";
|
||||
}
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
|
||||
@@ -213,91 +148,68 @@ $result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
|
||||
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
|
||||
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
|
||||
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
|
||||
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder);
|
||||
print ' ';
|
||||
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
|
||||
print '<input type="hidden" name="action" value="ventil">';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccounting"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
|
||||
print '<tr class="liste_titre"><td>' . $langs->trans("Invoice") . '</td>';
|
||||
print '<td>' . $langs->trans("Ref") . '</td>';
|
||||
print '<td>' . $langs->trans("Label") . '</td>';
|
||||
print '<td>' . $langs->trans("Description") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("Amount") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("AccountAccounting") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
|
||||
print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// We add search filter
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" value="' . $search_invoice . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td align="right" class="liste_titre" colspan="4">';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
|
||||
print ' ';
|
||||
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$facture_static = new Facture($db);
|
||||
$product_static = new Product($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$var = true;
|
||||
|
||||
$var = True;
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
$objp->code_sell_l = '';
|
||||
$objp->code_sell_p = '';
|
||||
$objp->aarowid_suggest = '';
|
||||
$code_sell_p_l_differ = '';
|
||||
|
||||
$code_sell_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
if (! empty($objp->code_sell)) {
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
} else {
|
||||
$code_sell_p_notset = 'color:red';
|
||||
if ($objp->type == 1) {
|
||||
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
} elseif ($objp->type == 0) {
|
||||
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
// product_type: 0 = service ? 1 = product
|
||||
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
|
||||
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
|
||||
$code_sell_notset = '';
|
||||
|
||||
if (empty($objp->code_sell)) {
|
||||
$code_sell_notset = 'color:red';
|
||||
|
||||
if (! empty($objp->type)) {
|
||||
if ($objp->type == 1) {
|
||||
$objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
} else {
|
||||
$objp->code_sell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
}
|
||||
} else {
|
||||
$code_sell_notset = 'color:blue';
|
||||
|
||||
if ($objp->type == 1) {
|
||||
$objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
} else {
|
||||
$objp->code_sell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_s;
|
||||
} elseif ($objp->type_l == 0) {
|
||||
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_p;
|
||||
}
|
||||
if ($objp->code_sell_l != $objp->code_sell_p)
|
||||
$code_sell_p_l_differ = 'color:red';
|
||||
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
// Ref Invoice
|
||||
|
||||
// Ref facture
|
||||
$facture_static->ref = $objp->facnumber;
|
||||
$facture_static->id = $objp->facid;
|
||||
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
|
||||
// Ref Product
|
||||
|
||||
// Ref produit
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
@@ -307,42 +219,38 @@ if ($result) {
|
||||
else
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
|
||||
|
||||
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
|
||||
print '<td align="right">';
|
||||
print price($objp->total_ht);
|
||||
print '</td>';
|
||||
if ($objp->vat_tx_l <> $objp->vat_tx_p) $code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
|
||||
print '<td style="' . $code_vat_differ . '" align="center">';
|
||||
print price($objp->tva_tx_line);
|
||||
|
||||
print '<td align="center" style="' . $code_sell_notset . '">';
|
||||
print $objp->code_sell;
|
||||
print '</td>';
|
||||
print '<td align="center" style="' . $code_sell_p_notset . '">';
|
||||
if ($objp->code_sell_l == $objp->code_sell_p) {
|
||||
print $objp->code_sell_l;
|
||||
} else {
|
||||
print 'lines=' . $objp->code_sell_l . '<br />product=' . $objp->code_sell_p;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Colonne choix du compte
|
||||
print '<td align="center">';
|
||||
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
|
||||
print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1);
|
||||
print '</td>';
|
||||
print '<td align="center">' . $objp->rowid . '</td>';
|
||||
|
||||
// Colonne choix ligne a ventiler
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
$i ++;
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
|
||||
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></div>';
|
||||
print '</form>';
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
$db->close();
|
||||
llxFooter();
|
||||
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
*
|
||||
@@ -36,7 +36,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
@@ -116,7 +115,6 @@ $object = new Account($db);
|
||||
$paymentstatic = new Paiement($db);
|
||||
$paymentsupplierstatic = new PaiementFourn($db);
|
||||
$societestatic = new Societe($db);
|
||||
$userstatic = new User($db);
|
||||
$chargestatic = new ChargeSociales($db);
|
||||
$paymentvatstatic = new TVA($db);
|
||||
$paymentsalstatic = new PaymentSalary($db);
|
||||
@@ -129,8 +127,8 @@ if ($result) {
|
||||
// Variables
|
||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
|
||||
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef"));
|
||||
$accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
|
||||
$accountancy_account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
$tabpay = array ();
|
||||
$tabbq = array ();
|
||||
@@ -169,14 +167,12 @@ if ($result) {
|
||||
}
|
||||
$links = $object->get_url($obj->rowid);
|
||||
|
||||
// get_url may return -1 which is not traversable
|
||||
if (is_array($links))
|
||||
{
|
||||
|
||||
|
||||
foreach ( $links as $key => $val )
|
||||
{
|
||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||
|
||||
|
||||
if ($links[$key]['type'] == 'payment')
|
||||
{
|
||||
$paymentstatic->id = $links[$key]['url_id'];
|
||||
@@ -195,13 +191,6 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||
}
|
||||
else if ($links[$key]['type'] == 'user')
|
||||
{
|
||||
$userstatic->id = $links[$key]['url_id'];
|
||||
$userstatic->name = $links[$key]['label'];
|
||||
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
|
||||
// $tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
||||
}
|
||||
else if ($links[$key]['type'] == 'sc')
|
||||
{
|
||||
$chargestatic->id = $links[$key]['url_id'];
|
||||
@@ -240,8 +229,8 @@ if ($result) {
|
||||
{
|
||||
$paymentvatstatic->id = $links[$key]['url_id'];
|
||||
$paymentvatstatic->ref = $links[$key]['url_id'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat");
|
||||
$tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount;
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
|
||||
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
|
||||
}
|
||||
else if ($links[$key]['type'] == 'payment_salary')
|
||||
{
|
||||
@@ -260,14 +249,11 @@ if ($result) {
|
||||
$tabtp [$obj->rowid] [$accountancy_account_salary] += $obj->amount;
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
||||
|
||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||
|
||||
$i++;
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
@@ -433,10 +419,11 @@ if ($action == 'export_csv')
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||
{
|
||||
$sep = ";";
|
||||
|
||||
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
|
||||
@@ -517,7 +504,7 @@ if ($action == 'export_csv')
|
||||
// Third party
|
||||
if (is_array ( $tabtp[$key]))
|
||||
{
|
||||
foreach ( $tabtp[$key] as $k => $mt )
|
||||
foreach ( $tabtp[$key] as $k => $mt )
|
||||
{
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
@@ -531,7 +518,7 @@ if ($action == 'export_csv')
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
foreach ( $tabbq[$key] as $k => $mt )
|
||||
{
|
||||
if (1)
|
||||
@@ -564,16 +551,16 @@ else
|
||||
$h=0;
|
||||
$head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal;
|
||||
$head[$h][1] = $langs->trans("Report");
|
||||
$head[$h][2] = 'card';
|
||||
$head[$h][2] = 'report';
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("BankJournal"), 0, 'payment');
|
||||
dol_fiche_head($head, $hselected);
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal.'">';
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
// Title
|
||||
print '<tr>';
|
||||
print '<td width="110">'.$langs->trans("ReportName").'</td>';
|
||||
print '<td valign="top" width="110">'.$langs->trans("ReportName").'</td>';
|
||||
print '<td colspan="3">'.$namereport.'</td>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@@ -590,7 +577,7 @@ else
|
||||
|
||||
// Description
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("ReportDescription").'</td>';
|
||||
print '<td valign="top">'.$langs->trans("ReportDescription").'</td>';
|
||||
print '<td colspan="3">'.$description.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -604,7 +591,7 @@ else
|
||||
|
||||
print '</div>';
|
||||
// End report
|
||||
|
||||
|
||||
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
|
||||
|
||||
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writeBookKeeping();" />';
|
||||
@@ -689,7 +676,6 @@ else
|
||||
print "<td>" . $reflabel . "</td>";
|
||||
print "<td>" . $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE . "</td>";
|
||||
print "<td>" . $langs->trans('ThirdParty') . "</td>";
|
||||
print "<td> </td>";
|
||||
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
|
||||
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
|
||||
print "</tr>";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
@@ -96,7 +96,7 @@ $sql .= " JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = fd.fk_factu
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " WHERE f.fk_statut > 0 ";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
|
||||
$sql .= " AND f.entity = " . $conf->entity;
|
||||
}
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
$sql .= " AND f.type IN (0,1,2)";
|
||||
@@ -112,7 +112,7 @@ if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
// les variables
|
||||
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
|
||||
$tabfac = array ();
|
||||
$tabht = array ();
|
||||
@@ -260,7 +260,7 @@ if ($action == 'writebookkeeping') {
|
||||
* View
|
||||
*/
|
||||
|
||||
$companystatic = new Fournisseur($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
// Export
|
||||
if ($action == 'export_csv')
|
||||
@@ -269,11 +269,7 @@ if ($action == 'export_csv')
|
||||
$purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
||||
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_achats.csv";
|
||||
else
|
||||
$filename="journal_achats.csv";
|
||||
header('Content-Disposition: attachment;filename='.$filename);
|
||||
header('Content-Disposition: attachment;filename=journal_achats.csv');
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||
{
|
||||
@@ -432,6 +428,7 @@ if ($action == 'export_csv')
|
||||
$r = '';
|
||||
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
$companystatic = new Fournisseur($db);
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$invoicestatic->id = $key;
|
||||
@@ -494,4 +491,4 @@ if ($action == 'export_csv')
|
||||
// End of page
|
||||
llxFooter();
|
||||
}
|
||||
$db->close();
|
||||
$db->close();
|
||||
@@ -4,10 +4,9 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.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
|
||||
@@ -60,8 +59,6 @@ if ($user->societe_id > 0)
|
||||
|
||||
$action = GETPOST('action');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@@ -89,8 +86,8 @@ $idpays = $p[0];
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
|
||||
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
|
||||
$sql .= " fd.situation_percent,ct.accountancy_code_sell as account_tva";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte, ";
|
||||
$sql .= " ct.accountancy_code_sell as account_tva";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
@@ -99,21 +96,19 @@ $sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_tva as ct ON fd.tva_tx = ct.taux AND ct.fk_pays = '" . $idpays . "'";
|
||||
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
|
||||
$sql .= " AND f.entity = " . $conf->entity;
|
||||
}
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql.= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
|
||||
}
|
||||
else {
|
||||
$sql.= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_STANDARD.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
|
||||
}
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
|
||||
$sql .= " AND f.type IN (0,1,2)";
|
||||
else
|
||||
$sql .= " AND f.type IN (0,1,2,3)";
|
||||
$sql .= " AND fd.product_type IN (0,1)";
|
||||
if ($date_start && $date_end)
|
||||
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
|
||||
$sql .= " ORDER BY f.datef";
|
||||
|
||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||
dol_syslog('accountancy/journal/sellsjournal.php:: $sql=' . $sql);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$tabfac = array ();
|
||||
@@ -138,24 +133,9 @@ if ($result) {
|
||||
else
|
||||
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
}
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef");
|
||||
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
|
||||
|
||||
// Situation invoices handling
|
||||
$line = new FactureLigne($db);
|
||||
$line->fetch($obj->rowid);
|
||||
$prev_progress = $line->get_prev_progress();
|
||||
if ($obj->type==Facture::TYPE_SITUATION) {
|
||||
// Avoid divide by 0
|
||||
if ($obj->situation_percent == 0) {
|
||||
$situation_ratio = 0;
|
||||
} else {
|
||||
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
|
||||
}
|
||||
} else {
|
||||
$situation_ratio = 1;
|
||||
}
|
||||
|
||||
// Invoice lines
|
||||
$tabfac[$obj->rowid]["date"] = $obj->df;
|
||||
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
|
||||
@@ -168,9 +148,9 @@ if ($result) {
|
||||
$tabht[$obj->rowid][$compta_prod] = 0;
|
||||
if (! isset($tabtva[$obj->rowid][$compta_tva]))
|
||||
$tabtva[$obj->rowid][$compta_tva] = 0;
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc * $situation_ratio;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht * $situation_ratio;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva * $situation_ratio;
|
||||
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
|
||||
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
|
||||
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
|
||||
$tabcompany[$obj->rowid] = array (
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
@@ -185,19 +165,15 @@ if ($result) {
|
||||
|
||||
/*
|
||||
* Action
|
||||
* FIXME Action must be set before any view part to respect MVC
|
||||
*/
|
||||
|
||||
// Bookkeeping Write
|
||||
if ($action == 'writebookkeeping')
|
||||
{
|
||||
if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
foreach ($tabfac as $key => $val)
|
||||
{
|
||||
foreach ($tabttc[$key] as $k => $mt)
|
||||
{
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@@ -223,7 +199,7 @@ if ($action == 'writebookkeeping')
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ($tabht[$key] as $k => $mt) {
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
// get compte id and label
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
@@ -256,10 +232,8 @@ if ($action == 'writebookkeeping')
|
||||
|
||||
// VAT
|
||||
// var_dump($tabtva);
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->doc_ref = $val["ref"];
|
||||
@@ -290,26 +264,20 @@ if ($action == 'writebookkeeping')
|
||||
setEventMessage($langs->trans("GeneralLedgerIsWritten"),'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
// Export
|
||||
if ($action == 'export_csv')
|
||||
{
|
||||
if ($action == 'export_csv') {
|
||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
||||
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_ventes.csv";
|
||||
else
|
||||
$filename="journal_ventes.csv";
|
||||
header('Content-Disposition: attachment;filename='.$filename);
|
||||
header('Content-Disposition: attachment;filename=journal_ventes.csv');
|
||||
|
||||
$companystatic = new Client($db);
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||
{
|
||||
$sep = ";";
|
||||
|
||||
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
@@ -359,11 +327,9 @@ if ($action == 'export_csv')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Model Classic Export
|
||||
} else // Model Classic Export
|
||||
{
|
||||
foreach ($tabfac as $key => $val)
|
||||
{
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
@@ -381,11 +347,10 @@ if ($action == 'export_csv')
|
||||
}
|
||||
|
||||
// Product / Service
|
||||
foreach ($tabht[$key] as $k => $mt)
|
||||
{
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
|
||||
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
@@ -398,8 +363,7 @@ if ($action == 'export_csv')
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
@@ -471,8 +435,7 @@ if ($action == 'export_csv')
|
||||
$invoicestatic = new Facture($db);
|
||||
$companystatic = new Client($db);
|
||||
|
||||
foreach ($tabfac as $key => $val)
|
||||
{
|
||||
foreach ( $tabfac as $key => $val ) {
|
||||
$invoicestatic->id = $key;
|
||||
$invoicestatic->ref = $val["ref"];
|
||||
$invoicestatic->type = $val["type"];
|
||||
@@ -480,8 +443,7 @@ if ($action == 'export_csv')
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
// Third party
|
||||
foreach ($tabttc[$key] as $k => $mt)
|
||||
{
|
||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
|
||||
@@ -497,11 +459,10 @@ if ($action == 'export_csv')
|
||||
print "</tr>";
|
||||
|
||||
// Product / Service
|
||||
foreach ($tabht[$key] as $k => $mt)
|
||||
{
|
||||
foreach ( $tabht[$key] as $k => $mt ) {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch(null, $k);
|
||||
|
||||
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
@@ -515,8 +476,7 @@ if ($action == 'export_csv')
|
||||
}
|
||||
|
||||
// VAT
|
||||
foreach ($tabtva[$key] as $k => $mt)
|
||||
{
|
||||
foreach ( $tabtva[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print "<tr " . $bc[$var] . ">";
|
||||
print "<td>" . $date . "</td>";
|
||||
@@ -537,5 +497,4 @@ if ($action == 'export_csv')
|
||||
// End of page
|
||||
llxFooter();
|
||||
}
|
||||
|
||||
$db->close();
|
||||
$db->close();
|
||||