Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

is reverts commit 8a4041e534.

Conflicts:

	htdocs/core/lib/company.lib.php
	htdocs/install/mysql/migration/3.4.0-3.5.0.sql
	htdocs/societe/class/societe.class.php

Conflicts:
	ChangeLog
	htdocs/core/lib/company.lib.php
This commit is contained in:
Christophe Battarel 2013-09-24 15:52:19 +02:00
commit aa820d56ba
686 changed files with 177963 additions and 4774 deletions

88
.travis.yml Normal file
View File

@ -0,0 +1,88 @@
# This script is used by Travis CI to run automatically Continuous test integration
# from Dolibarr GitHub repository.
# Command run is phpunit
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
services:
- memcached # will start memcached
# This will tell travis to run phpunit
language: php
php:
- "5.3"
- "5.4"
env:
- DB=mysql
# - DB=postgres
before_script:
- echo Start travis
- echo Current dir is `pwd`
- echo Home dir is `echo ~`
- echo Update composer
# - ~/.phpenv/versions/$(phpenv version-name)/bin/composer.phar self-update
- echo Install phpcs then show installed rules
- pyrus install pear/PHP_CodeSniffer
- phpenv rehash
- phpcs -i
- echo Create dir $(pwd)/htdocs/documents
- sudo mkdir -p $(pwd)/htdocs/documents/admin/temp;
- sudo touch $(pwd)/htdocs/documents/dolibarr.log;
- sudo chmod a+rwx /home; sudo chmod a+rwx /home/travis; sudo chmod -R a+rwx /home/travis/build;
- sudo chmod -R a+rwx $(pwd);
- sudo chown -R www-data:travis $(pwd)/htdocs/documents;
- find $(pwd)/htdocs/documents -type d -exec ls -alt {} \;
- echo Edit php.ini file
- echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
# - echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- echo "zend_extension_ts = xdebug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- cat ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- 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"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS myapp_test;'; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -D myapp_test < $(pwd)/dev/initdata/mysqldump_dolibarr_3.5.0.sql; fi"
- echo Create config file htdocs/conf/conf.php
- echo '<?php ' > htdocs/conf/conf.php
- sh -c "if [ '$DB' = 'pgsql' ]; then echo '$'dolibarr_main_db_type=\'pgsql\'';' >> htdocs/conf/conf.php; fi"
- sh -c "if [ '$DB' = 'mysql' ]; then echo '$'dolibarr_main_db_type=\'mysqli\'';' >> htdocs/conf/conf.php; fi"
- echo '$'dolibarr_main_url_root=\'http://localhost/\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_document_root=\'$(pwd)/htdocs\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_data_root=\'$(pwd)/htdocs/documents\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_host=\'localhost\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_name=\'myapp_test\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_db_user=\'travis\'';' >> htdocs/conf/conf.php
- echo '$'dolibarr_main_authentication=\'dolibarr\'';' >> htdocs/conf/conf.php
- echo '?>' >> htdocs/conf/conf.php
- echo Show conf.php content
- cat htdocs/conf/conf.php
- echo Install apache server
- sudo apt-get update
- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl php5-mysql php5-pgsql php5-intl
- sudo sed -i -e "s,/var/www,$(pwd)/htdocs,g" /etc/apache2/sites-available/default
- echo Show default virtual host
- sudo cat /etc/apache2/sites-available/default
- sudo /etc/init.d/apache2 restart
- wget http://localhost/
- cat index.html
script:
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/AllTests.php
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml --coverage-text test/phpunit/BuildDocTest.php
# - phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/WebservicesOtherTest.php
# - phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ htdocs/core/class/dolgraph.class.php
- phpcs --warning-severity=0 -s --report-checkstyle --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
# - phpcs --warning-severity=0 -s --report-summary --standard=dev/codesniffer/ruleset.xml --tab-width=4 --ignore=/build/html/,/documents/,/includes/,/test/report/ .
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php
after_script:
# - echo Output dolibarr log file; cat $(pwd)/htdocs/documents/dolibarr.log
- echo Output apache log file; sudo cat /var/log/apache2/error.log
- echo End travis

View File

@ -6,8 +6,8 @@ English Dolibarr ChangeLog
For users:
- New: Add hidden option BANK_DISABLE_DIRECT_INPUT.
- New: More options to select status of users into select user list.
- New: [ task #862 ] Add ODT on shipments
- New: [ task #149 ] Add # of notes and attachments in tabs
- New: [ task #862 ] Add ODT on shipments.
- New: [ task #149 ] Add # of notes and attachments in tabs.
- New: Can edit customer ref at eny time.
- New: [ task #877 ] Reorganize menus.
- New: [ task #858 ] Holiday module: note on manual holiday assignation.
@ -53,10 +53,28 @@ For users:
- New : User permissions on margin module
- New : Add ref supplier into muscadet model
- New : Add ability to copy contact address to clipboard
=======
- New: [ task #1005 ] Adapting to Spanish legislation bill numbering.
- New: [ task #1011 ] Now supplier order and invoice deal with payment terms and mode.
- New: [ task #1014 ] Add option to recursivly add parent category.
- New: [ task #1016 ] Can define a specific numbering for deposits.
- New: [ task #918 ] Stock replenishment.
- Fix: [ bug #992 ] Proforma invoices don't have a separated numeric count.
- New: Add pdf link into supplier invoice list and supplier order list.
- New: Genrate auto the PDF for supplier invoice.
- New: Add category into filter webservice thirdparty method getListOfThirdParties.
- New: Allow to define margin or mark rate during quoting, ordering, invoicing.
- New: User permissions on margin module.
- New: Add ref supplier into muscadet model.
- New: Can use tag {mm} before {yy} even when there is a reset into numbering masks.
- New: [ task #1060 ] Register fields localtax(1|2)_type into details tables.
- New: [ task #923 ] Localtax support for ODT templates.
- New: [ task #90 ] Barcode search.
- New: Can send an email from thirdparty card.
For translators:
- Qual: Normalized sort order of all languages files with english reference files.
- New: Add language code files for South Africa.
- New: Add language code files for South Africa, France new caledonia.
- New: Translate the email to change password.
For developers:
@ -82,6 +100,7 @@ For developers:
- New: Add hook addHomeSetup.
- New: Add trigger CATEGORY_LINK and CATEGORY_UNLINK.
- New: A trigger can return an array of error strings instead of one error string.
- New: Add method to use a dictionnary as a combo box.
WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better:
@ -99,9 +118,11 @@ Goal is to fix old compatibility code that does not match hook specifications:
All content added must be tagged by a '<div>' with css class="login_block_elem"
3) Some methods object->addline used a first parameter that was object->id, some not. Of course
this was not a good pratice, since object->id is already known so no need to provide it as
this was not a good pratice, since object->id is already known, there is no need to provide id as
parameter. All methods addline in this case were modified to remove this parameter.
4) Method ->classer_facturee() is deprecated. It must be replace with ->classifyBilled().
***** ChangeLog for 3.4.1 compared to 3.4.0 *****
Fix: Display buying price on line edit when no supplier price is defined
@ -122,6 +143,13 @@ Fix: Mailing module : if an email is already in destinaires list all other email
Fix: Localtaxes balance not showing
Fix: Intervention box links to contracts id
Fix: Compatiblity with multicompany module
Fix: Edit propal line was losing product supplier price id
Fix: Delete linked element to supplier invoice when deleted
Fix: [ bug #1061 ] Bad info shipped products
Fix: [ bug #1062 ] Documents lost in propals and contracts validating
Fix: Supplier price displayed on document lines and margin infos didnt take discount
Qual: Add travis-ci integration
***** ChangeLog for 3.4 compared to 3.3.* *****
For users:
@ -179,6 +207,7 @@ For users:
- Fix: [Bug #958] LocalTax2 for Spain fails on Suppliers
- Fix: [ bug #972 ] Auto completion contact field do not take account the min caract number before search
- Fix: [ bug #971 ] html.form.class.php select_contact with autocomplete do not exclude id from exclude array
- Fix: Expedition creation, can retreive product from other expedition
For translators:
- Update language files.

2
README
View File

@ -92,7 +92,7 @@ Main modules/features:
- Payments management
- Standing orders management
- Shipping management
- ECM (Electronic Content Management)
- EDM (Electronic Document Management)
- EMailings
- Agenda with ical,vcal export for third tools integration
- Management of foundation members

View File

@ -89,10 +89,10 @@ See ChangeLog file found into package.
- Shipping management
- PDF or ODT generation for invoice, proposals, orders...
- Agenda with ical,vcal export for third tools integration
- ECM (Electronic Content Management)
- EDM (Electronic Document Management)
- Foundations members management
- Employee's holidays management
- Mass emailing
- Mass Emailing
- Realize surveys
- Point of Sale

View File

@ -3,7 +3,7 @@
<!-- Exclude/ignore paths -->
<property name="ignorepaths" value="${basedir}/htdocs/conf,${basedir}/htdocs/core/filemanagerdol,${basedir}/htdocs/includes" />
<property name="ignoreregexp" value="**/PEAR/*,**/NET/*,**/HTTP/*" />
<property name="ignoreregexp" value="**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*" />
<target name="clean">
<!-- Clean up -->
@ -46,7 +46,7 @@
--exclude '${basedir}/htdocs/conf'
--exclude '${basedir}/htdocs/core/filemanagerdol'
--exclude '${basedir}/htdocs/includes'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
--min-tokens 70
--min-lines 20
htdocs
@ -61,7 +61,7 @@
--exclude '${basedir}/htdocs/conf'
--exclude '${basedir}/htdocs/core/filemanagerdol'
--exclude '${basedir}/htdocs/includes'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*'
--exclude '**/PEAR/*,**/NET/*,**/HTTP/*,**/zendgdata/*,**/reportico/*'
htdocs
" />
</exec>
@ -78,18 +78,11 @@
"/>
</exec>
</target>
<!-- Generate Doxygen documentation -->
<target name="doxygen" description="Dolibarr documentation" >
<exec executable="doxygen" dir="${basedir}" failonerror="false">
<arg value="${basedir}/build/doxygen/jenkins_doxygen.doxyfile"/>
</exec>
</target>
<!-- Run unit tests and generate junit.xml and clover.xml -->
<target name="phpunit">
<exec executable="phpunit" dir="${basedir}" failonerror="true">
<arg line=" --configuration ${basedir}/test/phpunit/jenkins_phpunittest.xml
<arg line=" --configuration ${basedir}/test/phpunit/phpunittest.xml
--log-junit ${basedir}/hudson/logs/junit.xml
--coverage-clover ${basedir}/hudson/coverage/clover.xml
--coverage-html ${basedir}/hudson/coverage/
@ -98,5 +91,12 @@
</exec>
</target>
<!-- Generate Doxygen documentation -->
<target name="doxygen" description="Dolibarr documentation" >
<exec executable="doxygen" dir="${basedir}" failonerror="false">
<arg value="${basedir}/build/doxygen/jenkins_doxygen.doxyfile"/>
</exec>
</target>
<target name="hudson" depends="clean,phpunit,phpcs,parallelTasks"/>
</project>

View File

@ -10,9 +10,9 @@ with format .DEB (for Debian, Ubuntu, ...).
# To build a debian package, you need first
# With Ubuntu 12.04
# apt-get install debhelper dpkg-source gpg lintian git-buildpackage pkg-php-tools schroot sbuild
# apt-get install debhelper dpkg-source gpg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php
# With Debian 7
# apt-get install debhelper dpkg gnupg lintian git-buildpackage pkg-php-tools schroot sbuild
# apt-get install debhelper dpkg gnupg lintian git-buildpackage pkg-php-tools schroot sbuild dh-linktree dh-make-php
# To generate gpg key for email used into changelog
@ -125,25 +125,29 @@ from origin/upstream and origin/pristine.
* Staying into git root directory, run
> git-import-orig -vv ../tcpdf_x.y.z+dfsg.orig.tar.xz
Note: If there was errors managed manually, you may need to make a git commit
Note: If there was errors solved manually, you may need to make a git commit
* Add an entry into debian/changelog
> dh "My comment" will add entry.
For example: dch -v x.y.z-1 "New upstream release." for a new version
Warning: Date must have format reported by "date -R"
Warning: Entry added here is used by next step. Name and email must match value into debian/control file.
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
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
Note: Package is built into directory ../build-area
* 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-buildpackage --git-tag
> git push --all
> git-buildpackage --git-tag-only --git-retag
> git push --all ou git push origin --all
> git push --tags
* Compilation par un développeur debian et envoi par
* Compilation is then done by a debian developer and sent
> sbuild ...
> dput ...
@ -170,3 +174,42 @@ 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.
* If new upstream is available onto sourceforge, launch:
> debian/get-orig-source.sh
* Staying into git root directory, run
> git-import-orig -vv ../dolibarr-3.3.4.tgz
Note: If there was errors solved manually after get-orig-sources.sh, you may need to make a git commit
* Add an entry into debian/changelog
> dh "My comment" will add entry.
For example: dch -v x.y.z-1 "New upstream release." for a new version
Then modify changelog to replace "unstable" with "UNRELEASED".
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
Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file
Note: Package is built into directory ../build-area
* 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-buildpackage --git-tag-only --git-retag
> git push --all ou git push origin --all
> git push --tags
* Compilation is then done by a debian developer and sent
> sbuild ...
> dput ...
* Go into page. You should see new package into unstable.
http://packages.qa.debian.org/t/tcpdf.html
* Package will be into release when test will be moved as stable.

View File

@ -6,7 +6,8 @@ Section: web
Priority: optional
Homepage: http://www.dolibarr.org
Build-Depends: debhelper (>= 7), po-debconf, dpatch
Comments: This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version
Package: dolibarr
Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5,
php5-mysql | php5-mysqli,

View File

@ -1,7 +1,7 @@
Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=174
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Dolibarr
Upstream-Contact: Laurent Destailleur <eldy@users.sourceforge.net>
Source: git@github.com:Dolibarr/dolibarr.git
Source: http://sourceforge.net/projects/dolibarr/files/
Files: *
Copyright: 2002-2009, Rodolphe Quiedeville <rodolphe@quiedeville.org>
@ -55,10 +55,110 @@ License: GPL-3+
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
License version 3 can be found in the file
`/usr/share/common-licenses/GPL-3'.
Files: htdocs/includes/adodbtime/*
Copyright: 2003-2005, John Lim
unknown, jackbbs
License: BSD
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
.
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
.
Neither the name of the John Lim nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
Comment:
Those files are not shipped in the binary package since we use
the library as packaged in "libphp-adodb".
Files: htdocs/includes/ckeditor/*
Copyright: 2003-2012 CKSource - Frederico Knabben
License: GPL-2+
The ckeditor is tripple licensed under the GNU General Public License (GPL),
GNU Lesser General Public License (LGPL), and Mozilla Public License (MPL).
In Debian, it is distributed under the GNU General Public License (GPL).
.
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/>.
.
On Debian systems, the complete text of the GNU General Public License
can be found in /usr/share/common-licenses/GPL-2 file.
Comment:
Sources for all minified javascript libraries are available in same directory
than minified version (.min.js), except for ckeditor whose sources are files
ckeditor_basic_source.js, ckeditor_source.js and files into directory _source.
Those files are not shipped in the binary package since we use the
library as packaged in "ckeditor".
Files: htdocs/includes/fonts/*
Copyright: 2003, Bitstream Inc
unknown, Gavin Graham
License: other
Permission is hereby granted, free of charge, to any person obtaining
a copy of the fonts accompanying this license ("Fonts") and associated
documentation files (the "Font Software"), to reproduce and distribute
the Font Software, including without limitation the rights to use,
copy, merge, publish, distribute, and/or sell copies of the Font
Software, and to permit persons to whom the Font Software is furnished
to do so, subject to the following conditions:
.
The above copyright and trademark notices and this permission notice
shall be included in all copies of one or more of the Font Software
typefaces.
.
The Font Software may be modified, altered, or added to, and in
particular the designs of glyphs or characters in the Fonts may be
modified and additional glyphs or characters may be added to the
Fonts, only if the fonts are renamed to names not containing either
the words "Bitstream" or the word "Vera".
.
This License becomes null and void to the extent applicable to Fonts
or Font Software that has been modified and is distributed under the
"Bitstream Vera" names.
.
The Font Software may be sold as part of a larger software package but
no copy of one or more of the Font Software typefaces may be sold by
itself.
.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
.
Except as contained in this notice, the names of Gnome, the Gnome
Foundation, and Bitstream Inc., shall not be used in advertising or
otherwise to promote the sale, use or other dealings in this Font
Software without prior written authorization from the Gnome Foundation
or Bitstream Inc., respectively. For further information, contact:
fonts at gnome dot org.
Comments:
Those files are not shipped in the binary package as we
configure Dolibarr to use Dejavu fonts from "fonts-dejavu-core".
Files: docs/images/*
Copyright: Laurent Destailleur
License: CC-BY-SA-3.0
@ -76,9 +176,8 @@ License: CC-BY-SA-3.0
.
For more information, see http://creativecommons.org/licenses/by-sa/3.0/
Files: htdocs/includes/fpdi/*
Copyright: FPDFI team
Copyright: 2004-2011 Setasign - Jan Slabon
License: GPL-2+
This program is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public
@ -98,11 +197,35 @@ License: GPL-2+
On Debian systems, the full text of the GNU General Public
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
Comment:
Those files are not shipped in the binary package as we
configure Dolibarr to use the library packaged in "libfpdi-php".
Files: htdocs/includes/geoip/*
Copyright: 2007 MaxMind LLC
License: LGPL-2.1+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
.
This library 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
Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'.
Files: htdocs/includes/jquery/*
Copyright: JQuery team
License: MIT or GPL-2+
License: GPL-2+ or MIT
=== GPL-2+ LICENSE NOTICE ===
.
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
@ -122,6 +245,8 @@ License: MIT or GPL-2+
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
.
=== MIT LICENSE ===
.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@ -139,13 +264,19 @@ License: MIT or GPL-2+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Comment:
JQuery itself is not shipped in the binary package, instead Dolibarr is
configured to use the packaged version from "libjs-jquery" and
"libjs-jquery-ui". Most of the plugins are shipped though.
Files: htdocs/includes/jquery/plugins/flot/*
Copyright: Flot team
License: Public Domain
This work is not subject to copyright in any jurisdiction
Comment:
Those files are not shipped in the binary package because we configure
Dolibarr to use the files provided by "libjs-flot".
Files: htdocs/includes/jsgantt/*
Copyright: JSGantt team
@ -169,12 +300,28 @@ License: GPL-2+
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
Files: htdocs/includes/phpexcel/*
Copyright: PHPExcel team
License: LGPL 2.1
See http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html
Files: htdocs/includes/nusoap/*
Copyright: 2002-2010 NuSphere Corporation
License: LGPL-2.1+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
.
This library 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
Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'.
Comment:
Those files are not shipped in the binary package since we
configure Dolibarr to use the library provided in "libnusoap-php".
Files: htdocs/includes/odtphp/*
Copyright: 2008, Julien Pauli
@ -200,8 +347,44 @@ License: GPL-2+
License version 2 can be found in the file
`/usr/share/common-licenses/GPL-2'.
Files: htdocs/includes/phpexcel/*
Copyright: 2006-2011 PHPExcel (http://www.codeplex.com/PHPExcel)
License: LGPL-2.1+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
.
This library 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
Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the full text of the GNU Lesser General Public
License version 2.1 can be found in the file
`/usr/share/common-licenses/LGPL-2.1'.
Files: htdocs/includes/tcpdf/*
Copyright: TCPDF team
License: LGPL 3.0
See http://www.gnu.org/licenses/old-licenses/lgpl-3.0-standalone.html
Copyright: 2002-2013 Nicola Asuni - Tecnick.com LTD
License: LGPL-3.0+
TCPDF is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
.
TCPDF 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 Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License
along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU Lesser General
Public License version 3 can be found in "/usr/share/common-licenses/LGPL-3".
Comment:
Those files are not shipped in the binary package since we configure
Dolibarr to use the library provided by "php-tcpdf".

View File

@ -1,6 +1,6 @@
#!/bin/sh
# run with
# debian/get-orig-source.sh [x.y.z]
# Scan for new official sources and download file
# run with debian/get-orig-source.sh [x.y.z]
tmpdir=$(mktemp -d)
echo "tmpdir = $tmpdir"
@ -12,29 +12,12 @@ uscan --noconf --force-download --no-symlink --verbose --destdir=$tmpdir $uscan_
cd $tmpdir
tgzfile=$(echo *.tar.gz)
version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr_//; s/\.zip$//; s/_/./g; s/\+nmu1//; s/$/+dfsg/;')
# Extract the zip file
tar -xvf $tgzfile
srcdir=$(find . -maxdepth 1 -mindepth 1 -type d | sed -e 's/\.\///')
if [ ! -d "$srcdir" ]; then
echo "ERROR: Failed to identify the extracted directory in $tmpdir (got $srcdir)" >&2
rm -rf $tmpdir
exit 1
fi
# Repack as tar.xz
tar Jcf dolibarr_${version}.orig.tar.xz $srcdir
tgzfile=$(echo *.tgz)
version=$(echo "$tgzfile" | perl -pi -e 's/^dolibarr-//; s/\.tgz$//; s/_/./g; s/\+nmu1//; ')
cd - >/dev/null
if [ -e ../dolibarr_${version}.orig.tar.xz ]; then
echo "Not overwriting ../dolibarr_${version}.orig.tar.xz";
else
echo "Created ../dolibarr_${version}.orig.tar.xz"
mv $tmpdir/dolibarr_${version}.orig.tar.xz ../
fi
mv $tmpdir/dolibarr-${version}.tgz ../
echo "File ../dolibarr-${version}.tgz is ready for git-import"
#rm -rf $tmpdir
rm -rf $tmpdir

View File

@ -2,4 +2,4 @@
version=3
#http://sf.net/dolibarr/dolibarr-(.+)\.tgz
http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_(.+)\.tar\.gz
http://www.dolibarr.org/files/stable/standard/dolibarr-(.+)\.tgz

File diff suppressed because it is too large Load Diff

View File

@ -107,13 +107,13 @@ Source: "C:\Program Files\Wamp\bin\apache\apache2.2.11\*.*"; DestDir: "{app}\bin
Source: "C:\Program Files\Wamp\bin\php\php5.3.0\*.*"; DestDir: "{app}\bin\php\php5.3.0"; Flags: ignoreversion recursesubdirs; Excludes: "php.ini,phpForApache.ini,wampserver.conf,*.log,*_log"
Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\mysql\mysql5.0.45"; Flags: ignoreversion recursesubdirs; Excludes: "my.ini,data\*,wampserver.conf,*.log,*_log,MySQLInstanceConfig.exe"
; Mysql data files (does not overwrite if exists)
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db"
Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db"
; Dolibarr
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,xdebug\*"
Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"
Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".cvsignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php"
Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,xdebug\*"
Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png"
Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php"
Source: "*.*"; DestDir: "{app}\www\dolibarr"; Flags: ignoreversion; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,default.properties,install.lock"
; Config files
Source: "build\exe\doliwamp\phpmyadmin.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
Source: "build\exe\doliwamp\dolibarr.conf.install"; DestDir: "{app}\alias"; Flags: ignoreversion;
@ -1018,4 +1018,3 @@ Type: filesandordirs; Name: "{app}\www\dolibarr"
[UninstallRun]
Filename: "{app}\uninstall_services.bat"; Flags: runhidden

View File

@ -18,6 +18,7 @@ $RPMSUBVERSION="auto"; # auto use value found into BUILD
"SNAPSHOT"=>"tar",
"TGZ"=>"tar",
"ZIP"=>"7z",
"XZ"=>"xz",
"RPM_GENERIC"=>"rpmbuild",
"RPM_FEDORA"=>"rpmbuild",
"RPM_MANDRIVA"=>"rpmbuild",
@ -35,6 +36,7 @@ $FILENAME="$PROJECT";
$FILENAMESNAPSHOT="$PROJECT-snapshot";
$FILENAMETGZ="$PROJECT-$MAJOR.$MINOR.$BUILD";
$FILENAMEZIP="$PROJECT-$MAJOR.$MINOR.$BUILD";
$FILENAMEXZ="$PROJECT-$MAJOR.$MINOR.$BUILD";
$FILENAMERPM="$PROJECT-$MAJOR.$MINOR.$BUILD-$RPMSUBVERSION";
$FILENAMEDEB="${PROJECT}_${MAJOR}.${MINOR}.${BUILD}";
$FILENAMEAPS="$PROJECT-$MAJOR.$MINOR.$BUILD.app";
@ -179,6 +181,7 @@ foreach my $target (keys %CHOOSEDTARGET) {
print "Test requirement for target $target: Search '$req'... ";
$newreq=$req; $newparam='';
if ($newreq eq 'zip') { $newparam.='-h'; }
if ($newreq eq 'xz') { $newparam.='-h'; }
$cmd="\"$newreq\" $newparam 2>&1";
print "Test command ".$cmd."... ";
$ret=`$cmd`;
@ -277,6 +280,7 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.xz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/doxygen/doxygen_warnings.log`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/cache.manifest`;
@ -336,6 +340,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems.
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems.
$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/phpexcel/license.txt`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`;
@ -370,7 +375,7 @@ if ($nboftargetok) {
print "Compress $BUILDROOT into $FILENAMESNAPSHOT.tgz...\n";
#$cmd="tar --exclude \"$BUILDROOT/tgz/tar_exclude.txt\" --exclude .cache --exclude .settings --exclude conf.php --directory \"$BUILDROOT\" -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT";
$cmd="tar --exclude doli*.tgz --exclude doli*.deb --exclude doli*.exe --exclude doli*.zip --exclude doli*.rpm --exclude .cache --exclude .settings --exclude conf.php --exclude conf.php.mysql --exclude conf.php.old --exclude conf.php.postgres --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT";
$cmd="tar --exclude doli*.tgz --exclude doli*.deb --exclude doli*.exe --exclude doli*.xz --exclude doli*.zip --exclude doli*.rpm --exclude .cache --exclude .settings --exclude conf.php --exclude conf.php.mysql --exclude conf.php.old --exclude conf.php.postgres --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMESNAPSHOT.tgz\" $FILENAMESNAPSHOT";
print $cmd."\n";
$ret=`$cmd`;
@ -406,6 +411,36 @@ if ($nboftargetok) {
next;
}
if ($target eq 'XZ')
{
$NEWDESTI=$DESTI;
if (-d $DESTI.'/standard') { $NEWDESTI=$DESTI.'/standard'; }
print "Remove target $FILENAMEXZ.xz...\n";
unlink("$NEWDESTI/$FILENAMEXZ.xz");
#rmdir "$BUILDROOT/$FILENAMEXZ";
$ret=`rm -fr $BUILDROOT/$FILENAMEXZ`;
print "Copy $BUILDROOT/$PROJECT to $BUILDROOT/$FILENAMEXZ\n";
$cmd="cp -pr \"$BUILDROOT/$PROJECT\" \"$BUILDROOT/$FILENAMEXZ\"";
$ret=`$cmd`;
print "Compress $FILENAMEXZ into $FILENAMEXZ.xz...\n";
print "Go to directory $BUILDROOT\n";
$olddir=getcwd();
chdir("$BUILDROOT");
$cmd= "xz -9 -r $BUILDROOT/$FILENAMEAPS.xz \*";
print $cmd."\n";
$ret= `$cmd`;
chdir("$olddir");
# Move to final dir
print "Move $FILENAMEXZ.xz to $NEWDESTI/$FILENAMEXZ.xz\n";
$ret=`mv "$BUILDROOT/$FILENAMEXZ.xz" "$NEWDESTI/$FILENAMEXZ.xz"`;
next;
}
if ($target eq 'ZIP')
{
$NEWDESTI=$DESTI;

View File

@ -31,5 +31,5 @@ How to have such a service ?
Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-3.3.2-3.src.rpm
Then add into advanded - attributes
OBS:Screenshots http://www.dolibarr.org/images/phocagallery/dolibarr_screenshot1.png
OBS:QualityCategory Testing
OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png
OBS:QualityCategory Testing

6
build/sitemap/README Normal file
View File

@ -0,0 +1,6 @@
# Format of sitemap file is available at
# http://www.sitemaps.org/protocol.html
# To build a sitemap from urllist-bing.txt, run
# google-sitemapgen --config=config-bing.xml --testing

View File

@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
sitemap_gen.py example configuration script
This file specifies a set of sample input parameters for the
sitemap_gen.py client.
You should copy this file into "config.xml" and modify it for
your server.
********************************************************* -->
<!-- ** MODIFY **
The "site" node describes your basic web site.
Required attributes:
base_url - the top-level URL of the site being mapped
store_into - the webserver path to the desired output file.
This should end in '.xml' or '.xml.gz'
(the script will create this file)
Optional attributes:
verbose - an integer from 0 (quiet) to 3 (noisy) for
how much diagnostic output the script gives
suppress_search_engine_notify="1"
- disables notifying search engines about the new map
(same as the "testing" command-line argument.)
default_encoding
- names a character encoding to use for URLs and
file paths. (Example: "UTF-8")
-->
<site
base_url="http://wiki.dolibarr.org/"
store_into="sitemap-wiki-bing.xml.gz"
verbose="1"
>
<!-- ********************************************************
INPUTS
All the various nodes in this section control where the script
looks to find URLs.
MODIFY or DELETE these entries as appropriate for your server.
********************************************************* -->
<!-- ** MODIFY or DELETE **
"url" nodes specify individual URLs to include in the map.
Required attributes:
href - the URL
Optional attributes:
lastmod - timestamp of last modification (ISO8601 format)
changefreq - how often content at this URL is usually updated
priority - value 0.0 to 1.0 of relative importance in your site
-->
<!--
<url href="http://www.example.com/stats?q=name" />
<url
href="http://www.example.com/stats?q=age"
lastmod="2004-11-14T01:00:00-07:00"
changefreq="yearly"
priority="0.3"
/>
-->
<!-- ** MODIFY or DELETE **
"urllist" nodes name text files with lists of URLs.
An example file "example_urllist.txt" is provided.
Required attributes:
path - path to the file
Optional attributes:
encoding - encoding of the file if not US-ASCII
-->
<urllist path="urllist-wiki.txt" encoding="UTF-8" />
<!-- ** MODIFY or DELETE **
"directory" nodes tell the script to walk the file system
and include all files and directories in the Sitemap.
Required attributes:
path - path to begin walking from
url - URL equivalent of that path
Optional attributes:
default_file - name of the index or default file for directory URLs
-->
<!--
<directory path="/var/www/icons" url="http://www.example.com/images/" />
<directory
path="/var/www/docroot"
url="http://www.example.com/"
default_file="index.html"
/>
-->
<!-- ** MODIFY or DELETE **
"accesslog" nodes tell the script to scan webserver log files to
extract URLs on your site. Both Common Logfile Format (Apache's default
logfile) and Extended Logfile Format (IIS's default logfile) can be read.
Required attributes:
path - path to the file
Optional attributes:
encoding - encoding of the file if not US-ASCII
-->
<!--
<accesslog path="/etc/httpd/logs/access.log" encoding="UTF-8" />
<accesslog path="/etc/httpd/logs/access.log.0" encoding="UTF-8" />
<accesslog path="/etc/httpd/logs/access.log.1.gz" encoding="UTF-8" />
-->
<!-- ** MODIFY or DELETE **
"sitemap" nodes tell the script to scan other Sitemap files. This can
be useful to aggregate the results of multiple runs of this script into
a single Sitemap.
Required attributes:
path - path to the file
-->
<!--
<sitemap path="/var/www/docroot/subpath/sitemap.xml" />
-->
<!-- ********************************************************
FILTERS
Filters specify wild-card patterns that the script compares
against all URLs it finds. Filters can be used to exclude
certain URLs from your Sitemap, for instance if you have
hidden content that you hope the search engines don't find.
Filters can be either type="wildcard", which means standard
path wildcards (* and ?) are used to compare against URLs,
or type="regexp", which means regular expressions are used
to compare.
Filters are applied in the order specified in this file.
An action="drop" filter causes exclusion of matching URLs.
An action="pass" filter causes inclusion of matching URLs,
shortcutting any other later filters that might also match.
If no filter at all matches a URL, the URL will be included.
Together you can build up fairly complex rules.
The default action is "drop".
The default type is "wildcard".
You can MODIFY or DELETE these entries as appropriate for
your site. However, unlike above, the example entries in
this section are not contrived and may be useful to you as
they are.
********************************************************* -->
<!-- Exclude URLs that end with a '~' (IE: emacs backup files) -->
<filter action="drop" type="wildcard" pattern="*~" />
<!-- Exclude URLs within UNIX-style hidden files or directories -->
<filter action="drop" type="regexp" pattern="/\.[^/]*" />
<filter action="drop" type="regexp" pattern="title=" />
</site>

View File

@ -0,0 +1 @@
http://wiki.dolibarr.org/

View File

@ -37,44 +37,26 @@ htdocs/customleave
htdocs/customgoogle
htdocs/document
htdocs/documents
htdocs/includes/jpgraph2
htdocs/includes/fckeditor/_samples
htdocs/includes/fckeditor/_testcases
htdocs/includes/nusoap/samples
htdocs/includes/phplot5
htdocs/includes/scriptaculous/test
htdocs/includes/treemenu/docs
htdocs/includes/treemenu/images
htdocs/includes/treemenu/imagesAlt
htdocs/includes/treemenu/imagesAlt2
htdocs/includes/tcpdf/fonts/utils
htdocs/includes/tcpdf/fonts/free*.ctg.z
htdocs/includes/tcpdf/fonts/free*.z
htdocs/lolix
htdocs/oscommerce_ws/ws_client_demo
htdocs/postnuke
htdocs/public/bplc
htdocs/rapport
htdocs/theme/rodolphe
htdocs/telephonie
htdocs/voyage
mssql
scripts/addons
scripts/books
scripts/courrier
scripts/lolix
scripts/product/import-product.php
scripts/product/materiel.net.php
test
CVS
*~
.#*
.buildpath
.cache
.cvsignore
.gitignore
.externalToolBuilders
.htaccess
.settings
.project
.travis.yml
Thumbs.db
data_dev.sql
doli*.tar.gz
@ -84,18 +66,5 @@ doli*.rpm
doli*.deb
doli*.zip
cvschangelogbuilder_dolibarr*
deneb
janus
jupiter
lune
mars
pluton
saturne
venus
bigorneau
tourteau
bulot
huitre
pdf_huitre.modules.php
doxygen_warnings.log
dolibarr_install.log

View File

@ -31,11 +31,8 @@
*/htdocs/custom2/*
*/htdocs/document/*
*/htdocs/documents/*
*/htdocs/lolix/*
*/htdocs/postnuke/*
*/htdocs/telephonie/*
*/htdocs/voyage/*
*/htdocs/includes/jpgraph2/*
*/htdocs/includes/ckeditor/_source
*/htdocs/includes/ckeditor/*_source.js
*/htdocs/includes/fckeditor/_samples/*
*/htdocs/includes/fckeditor/_testcases/*
*/htdocs/includes/nusoap/samples/*
@ -49,20 +46,18 @@
*/htdocs/includes/tcpdf/fonts/utils/*
*/htdocs/includes/tcpdf/fonts/free*.ctg.z
*/htdocs/includes/tcpdf/fonts/free*.z
*/htdocs/oscommerce_ws/ws_client_demo/*
*/htdocs/theme/rodolphe/*
*/scripts/addons/*
*/scripts/courrier/*
*/scripts/lolix/*
*/test
*/CVS/*
*~
*.#*
*.buildpath*
*.cache*
*.cvsignore*
*.gitignore*
*.htaccess*
*.settings*
*.project*
*.travis.yml*
Thumbs.db
data_dev.sql
dolibarr*.tar.gz
@ -72,19 +67,5 @@ dolibarr*.rpm
dolibarr*.deb
dolibarr*.zip
cvschangelogbuilder_dolibarr*
*/deneb/*
*/janus/*
*/jupiter/*
*/lune/*
*/mars/*
*/mercure/*
*/pluton/*
*/saturne/*
*/venus/*
*/bigorneau/*
*/tourteau/*
*/bulot/*
*/huitre/*
*/pdf_huitre.modules.php
doxygen_warnings.log
dolibarr_install.log

View File

@ -5,7 +5,11 @@
<!-- List of all tests -->
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
<rule ref="Internal.NoCodeFound">
<severity>0</severity>
</rule>
<rule ref="Generic.CodeAnalysis.EmptyStatement" />
<rule ref="Generic.CodeAnalysis.EmptyStatement.NotAllowed">
<severity>0</severity>
@ -211,14 +215,22 @@
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidClassName.StartWithCapital">
<severity>0</severity>
</rule>
<!-- some phpcs have a typo error in rule, so we add it too -->
<rule ref="PEAR.NamingConventions.ValidClassName.StartWithCaptial">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName" />
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNameInvalid">
<severity>0</severity>
</rule>
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCapital">
<severity>0</severity>
</rule>
<!-- some phpcs have a typo error in rule, so we add it too -->
<rule ref="PEAR.NamingConventions.ValidFunctionName.FunctionNoCaptial">
<severity>0</severity>
</rule>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -177,6 +177,7 @@ export list="
--ignore-table=$base.llx_bt_timestamps
--ignore-table=$base.llx_bt_webseedfiles
--ignore-table=$base.llx_dolicloud_customers
--ignore-table=$base.llx_dolicloud_stats
--ignore-table=$base.llx_c_dolicloud_plans
--ignore-table=$base.llx_cabinetmed_c_banques
--ignore-table=$base.llx_cabinetmed_c_ccam
@ -189,9 +190,15 @@ export list="
--ignore-table=$base.llx_cabinetmed_motifcons
--ignore-table=$base.llx_cabinetmed_patient
--ignore-table=$base.llx_cabinetmed_societe
--ignore-table=$base.llx_fournisseur_ca
--ignore-table=$base.llx_google_maps
--ignore-table=$base.llx_pos_paiement_ticket
--ignore-table=$base.llx_pos_places
--ignore-table=$base.llx_pos_ticket
--ignore-table=$base.llx_publi_c_contact_list
--ignore-table=$base.llx_publi_c_dnd_list
--ignore-table=$base.llx_publi_c_method_list
--ignore-table=$base.llx_publi_c_method_list
--ignore-table=$base.llx_ultimatepdf
"
echo "mysqldump -P$port -u$admin -p***** $list $base > $mydir/$dumpfile"
mysqldump -P$port -u$admin $passwd $list $base > $mydir/$dumpfile

View File

@ -50,7 +50,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -691,7 +691,7 @@ else
/* */
/* ************************************************************************** */
$object->canvas=$canvas;
$object->state_id = GETPOST('departement_id', 'int');
$object->state_id = GETPOST('state_id', 'int');
// We set country_id, country_code and country for the selected country
$object->country_id=GETPOST('country_id','int')?GETPOST('country_id','int'):$mysoc->country_id;

View File

@ -85,10 +85,12 @@ if ($action == "save" && empty($cancel))
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
$db->commit();
}
else
{
setEventMessage($langs->trans("Error"),'errors');
$db->rollback();
}
}

View File

@ -56,7 +56,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -57,7 +57,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -58,7 +58,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -58,7 +58,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -57,7 +57,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -43,23 +43,24 @@ $confirm = GETPOST('confirm');
$lineid = GETPOST('lineid','int');
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
if ($user->societe_id > 0)
{
unset($_GET["action"]);
$action='';
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id');
$object = new ActionComm($db);
/*
* Actions
*/
/*
* Ajout d'un nouveau contact
*/
// Add new nouveau contact
if ($action == 'addcontact')
{
$result = $object->fetch($id);

View File

@ -44,14 +44,14 @@ $objectid = GETPOST('id','int');
$action=GETPOST('action','alpha');
// Security check
$socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
if ($user->societe_id > 0)
{
unset($_GET["action"]);
$action='';
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', '', 'id');
$result = restrictedArea($user, 'agenda', $objectid, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id');
$act = new ActionComm($db);

View File

@ -56,8 +56,8 @@ $contactid=GETPOST('contactid','int');
$socid = GETPOST('socid','int');
$id = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user,'societe',$id,'&societe');
//$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id');
if ($user->societe_id && $socid) $result = restrictedArea($user,'societe',$socid);
$error=GETPOST("error");
$mesg='';
@ -1003,7 +1003,7 @@ if ($id > 0)
{
$project=new Project($db);
$project->fetch($act->fk_project);
print $project->getNomUrl(1);
print $project->getNomUrl(1,'',1);
}
print '</td></tr>';
}

View File

@ -40,7 +40,7 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', '', 'id');
$result = restrictedArea($user, 'agenda', $id, 'actioncomm&societe', 'myactions&allactions', 'fk_soc', 'id');
/*

View File

@ -51,7 +51,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -59,7 +59,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -115,9 +116,13 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
if ($search_nom) {
$sql .= natural_search('s.nom', $search_nom);
}
if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
if ($search_town) $sql.= " AND s.town LIKE '%".$db->escape($search_town)."%'";
if ($search_town) {
$sql .= natural_search('s.town', $search_town);
}
if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'";
// Insert sale filter

View File

@ -287,7 +287,6 @@ class Propal extends CommonObject
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,'',produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*
* @param int $propalid Id de la propale
* @param string $desc Description de la ligne
* @param double $pu_ht Prix unitaire
* @param double $qty Quantite
@ -315,6 +314,7 @@ class Propal extends CommonObject
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_option=0)
{
global $mysoc;
$propalid=$this->id;
dol_syslog(get_class($this)."::addline propalid=$propalid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type");
@ -355,7 +355,10 @@ class Propal extends CommonObject
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type);
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -390,6 +393,8 @@ class Propal extends CommonObject
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->fk_product=$fk_product;
$this->line->remise_percent=$remise_percent;
$this->line->subprice=$pu_ht;
@ -481,7 +486,7 @@ class Propal extends CommonObject
*/
function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_option=0)
{
global $conf,$user,$langs;
global $conf,$user,$langs, $mysoc;
dol_syslog(get_class($this)."::updateLine $rowid, $pu, $qty, $remise_percent, $txtva, $desc, $price_base_type, $info_bits");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -505,7 +510,10 @@ class Propal extends CommonObject
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type);
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -542,6 +550,8 @@ class Propal extends CommonObject
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->remise_percent = $remise_percent;
$this->line->subprice = $pu;
$this->line->info_bits = $info_bits;
@ -1261,7 +1271,9 @@ class Propal extends CommonObject
*/
function valid($user, $notrigger=0)
{
global $conf,$langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
global $conf,$langs;
$error=0;
$now=dol_now();
@ -1306,9 +1318,32 @@ class Propal extends CommonObject
}
// Fin appel triggers
}
if (! $error)
{
if (! $error)
{
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
// Rename of propal directory ($this->ref = old ref, $num = new ref)
// to not lose the linked files
$facref = dol_sanitizeFileName($this->ref);
$snumfa = dol_sanitizeFileName($num);
$dirsource = $conf->propal->dir_output.'/'.$facref;
$dirdest = $conf->propal->dir_output.'/'.$snumfa;
if (file_exists($dirsource))
{
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
if (@rename($dirsource, $dirdest))
{
dol_syslog("Rename ok");
// Deleting old PDF in new rep
dol_delete_file($conf->propal->dir_output.'/'.$snumfa.'/'.$facref.'*.*');
}
}
}
$this->brouillon=0;
$this->statut = 1;
$this->user_valid_id=$user->id;
@ -1317,13 +1352,13 @@ class Propal extends CommonObject
return 1;
}
else
{
{
$this->db->rollback();
return -2;
}
}
else
{
{
$this->db->rollback();
return -1;
}
@ -1603,9 +1638,7 @@ class Propal extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql.= " SET fk_statut = ".$this->statut.",";
if (! empty ( $note )) {
$sql .= " note_private = '" . $this->db->escape ( $note ) . "',";
}
if (! empty($note)) $sql.= " note_private = '".$this->db->escape($note)."',";
$sql.= " date_cloture=NULL, fk_user_cloture=NULL";
$sql.= " WHERE rowid = ".$this->id;
@ -1774,6 +1807,7 @@ class Propal extends CommonObject
* Class invoiced the Propal
*
* @return int <0 si ko, >0 si ok
* @deprecated
*/
function classer_facturee()
{
@ -2718,10 +2752,12 @@ class PropaleLigne extends CommonObject
var $libelle; // Label produit
var $product_desc; // Description produit
var $localtax1_tx;
var $localtax2_tx;
var $total_localtax1;
var $total_localtax2;
var $localtax1_tx; // Local tax 1
var $localtax2_tx; // Local tax 2
var $localtax1_type; // Local tax 1 type
var $localtax2_type; // Local tax 2 type
var $total_localtax1; // Line total local tax 1
var $total_localtax2; // Line total local tax 2
var $date_start;
var $date_end;
@ -2825,6 +2861,8 @@ class PropaleLigne extends CommonObject
if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
if (empty($this->localtax2_tx)) $this->localtax2_tx=0;
if (empty($this->localtax1_type)) $this->localtax1_type=0;
if (empty($this->localtax2_type)) $this->localtax2_type=0;
if (empty($this->total_localtax1)) $this->total_localtax1=0;
if (empty($this->total_localtax2)) $this->total_localtax2=0;
if (empty($this->rang)) $this->rang=0;
@ -2851,7 +2889,7 @@ class PropaleLigne extends CommonObject
// Insert line into database
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'propaldet';
$sql.= ' (fk_propal, fk_parent_line, label, description, fk_product, product_type,';
$sql.= ' fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx,';
$sql.= ' fk_remise_except, qty, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql.= ' subprice, remise_percent, ';
$sql.= ' info_bits, ';
$sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang,';
@ -2867,6 +2905,8 @@ class PropaleLigne extends CommonObject
$sql.= " ".price2num($this->tva_tx).",";
$sql.= " ".price2num($this->localtax1_tx).",";
$sql.= " ".price2num($this->localtax2_tx).",";
$sql.= " '".$this->localtax1_type."',";
$sql.= " '".$this->localtax2_type."',";
$sql.= " ".($this->subprice?price2num($this->subprice):"null").",";
$sql.= " ".price2num($this->remise_percent).",";
$sql.= " ".(isset($this->info_bits)?"'".$this->info_bits."'":"null").",";
@ -2992,6 +3032,8 @@ class PropaleLigne extends CommonObject
if (empty($this->localtax2_tx)) $this->localtax2_tx=0;
if (empty($this->total_localtax1)) $this->total_localtax1=0;
if (empty($this->total_localtax2)) $this->total_localtax2=0;
if (empty($this->localtax1_type)) $this->localtax1_type=0;
if (empty($this->localtax2_type)) $this->localtax2_type=0;
if (empty($this->marque_tx)) $this->marque_tx=0;
if (empty($this->marge_tx)) $this->marge_tx=0;
if (empty($this->remise)) $this->remise=0;
@ -2999,7 +3041,7 @@ class PropaleLigne extends CommonObject
if (empty($this->info_bits)) $this->info_bits=0;
if (empty($this->special_code)) $this->special_code=0;
if (empty($this->fk_parent_line)) $this->fk_parent_line=0;
if (empty($this->fk_parent_line)) $this->fk_fournprice=0;
if (empty($this->fk_fournprice)) $this->fk_fournprice=0;
if (empty($this->pa_ht)) $this->pa_ht=0;
@ -3018,6 +3060,8 @@ class PropaleLigne extends CommonObject
$sql.= " , tva_tx='".price2num($this->tva_tx)."'";
$sql.= " , localtax1_tx=".price2num($this->localtax1_tx);
$sql.= " , localtax2_tx=".price2num($this->localtax2_tx);
$sql.= " , localtax1_type='".$this->localtax1_type."'";
$sql.= " , localtax2_type='".$this->localtax2_type."'";
$sql.= " , qty='".price2num($this->qty)."'";
$sql.= " , subprice=".price2num($this->subprice)."";
$sql.= " , remise_percent=".price2num($this->remise_percent)."";

View File

@ -8,6 +8,7 @@
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -160,21 +161,17 @@ if (! $user->rights->societe->client->voir && ! $socid) //restriction
{
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
}
if ($search_town) //restriction
{
$sql.= " AND s.town LIKE '%".$db->escape(trim($search_town))."%'";
if ($search_town) {//restriction
$sql .= natural_search('s.town', $search_town);
}
if ($search_ref)
{
$sql.= " AND p.ref LIKE '%".$db->escape(trim($search_ref))."%'";
if ($search_ref) {
$sql .= natural_search('p.ref', $search_ref);
}
if ($search_refcustomer)
{
$sql.= " AND p.ref_client LIKE '%".$db->escape(trim($search_refcustomer))."%'";
if ($search_refcustomer) {
$sql .= natural_search('p.ref_client', $search_refcustomer);
}
if ($search_societe)
{
$sql.= " AND s.nom LIKE '%".$db->escape(trim($search_societe))."%'";
if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_author)
{
@ -184,7 +181,13 @@ if ($search_montant_ht)
{
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
}
if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%' OR pd.description LIKE '%".$db->escape($sall)."%')";
if ($sall) {
/*$scrit = explode(' ', $sall);
foreach ($scrit as $crit) {
$sql.= " AND (s.nom LIKE '%".$db->escape($crit)."%' OR p.note LIKE '%".$db->escape($crit)."%' OR pd.description LIKE '%".$db->escape($crit)."%')";
}*/
$sql .= natural_search(array('s.nom', 'p.note_private', 'pd.description'), $sall);
}
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if ($viewstatut <> '')
{
@ -289,7 +292,7 @@ if ($result)
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="16" name="search_societe" value="'.$search_societe.'">';
print '</td>';
print '<td>&nbsp;</td>';
print '<td class="liste_titre"><input class="flat" type="text" size="16" name="search_town" value="'.$search_town.'"></td>';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
print '</td>';

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -193,10 +194,16 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_nom) $sql .= " AND s.nom LIKE '%".$db->escape(strtolower($search_nom))."%'";
if ($search_nom) {
$sql .= natural_search('s.nom', $search_nom);
}
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
if ($search_town) $sql .= " AND s.town LIKE '%".$db->escape(strtolower($search_town))."%'";
if ($search_state) $sql .= " AND d.nom LIKE '%".$db->escape(strtolower($search_state))."%'";
if ($search_town) {
$sql .= natural_search('s.town', $search_town);
}
if ($search_state) {
$sql .= natural_search('d.nom', $search_state);
}
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
// Insert levels filters
if ($search_levels)
@ -208,9 +215,8 @@ if ($search_sale)
{
$sql .= " AND sc.fk_user = ".$db->escape($search_sale);
}
if ($socname)
{
$sql .= " AND s.nom LIKE '%".$db->escape($socname)."%'";
if ($socname) {
$sql .= natural_search('s.nom', $search_nom);
$sortfield = "s.nom";
$sortorder = "ASC";
}

View File

@ -3,10 +3,10 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU *General Public License as published by
@ -1037,6 +1037,8 @@ class Commande extends CommonOrder
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_option=0)
{
global $mysoc;
$commandeid=$this->id;
dol_syslog(get_class($this)."::addline commandeid=$commandeid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type", LOG_DEBUG);
@ -1083,7 +1085,10 @@ class Commande extends CommonOrder
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type);
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'', $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -1118,6 +1123,8 @@ class Commande extends CommonOrder
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->fk_product=$fk_product;
$this->line->fk_remise_except=$fk_remise_except;
$this->line->remise_percent=$remise_percent;
@ -1602,7 +1609,7 @@ class Commande extends CommonOrder
if ($filtre_statut >= 0) $sql.= ' ed.fk_expedition = e.rowid AND';
$sql.= ' ed.fk_origin_line = cd.rowid';
$sql.= ' AND cd.fk_commande =' .$this->id;
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut = '.$filtre_statut;
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut;
$sql.= ' GROUP BY cd.rowid, cd.fk_product';
//print $sql;
@ -2215,6 +2222,7 @@ class Commande extends CommonOrder
* Classify the order as invoiced
*
* @return int <0 if ko, >0 if ok
* @deprecated
*/
function classer_facturee()
{
@ -2249,7 +2257,7 @@ class Commande extends CommonOrder
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0)
{
global $conf;
global $conf, $mysoc;
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $date_start, $date_end, $type");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -2279,7 +2287,10 @@ class Commande extends CommonOrder
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type);
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -2318,6 +2329,8 @@ class Commande extends CommonOrder
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
$this->line->localtax2_tx=$txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->remise_percent=$remise_percent;
$this->line->subprice=$subprice;
$this->line->info_bits=$info_bits;
@ -2987,6 +3000,8 @@ class OrderLine extends CommonOrderLine
var $tva_tx; // VAT Rate for product/service (example 19.6)
var $localtax1_tx; // Local tax 1
var $localtax2_tx; // Local tax 2
var $localtax1_type; // Local tax 1 type
var $localtax2_type; // Local tax 2 type
var $subprice; // U.P. HT (example 100)
var $remise_percent; // % for line discount (example 20%)
var $fk_remise_except;
@ -3164,6 +3179,8 @@ class OrderLine extends CommonOrderLine
if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
if (empty($this->localtax2_tx)) $this->localtax2_tx=0;
if (empty($this->localtax1_type)) $this->localtax1_type=0;
if (empty($this->localtax2_type)) $this->localtax2_type=0;
if (empty($this->total_localtax1)) $this->total_localtax1=0;
if (empty($this->total_localtax2)) $this->total_localtax2=0;
if (empty($this->rang)) $this->rang=0;
@ -3188,7 +3205,8 @@ class OrderLine extends CommonOrderLine
// Insertion dans base de la ligne
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
$sql.= ' (fk_commande, fk_parent_line, label, description, qty, tva_tx, localtax1_tx, localtax2_tx,';
$sql.= ' (fk_commande, fk_parent_line, label, description, qty, ';
$sql.= ' tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql.= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,';
$sql.= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,';
$sql.= ' info_bits, total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, date_start, date_end)';
@ -3200,6 +3218,8 @@ class OrderLine extends CommonOrderLine
$sql.= " '".price2num($this->tva_tx)."',";
$sql.= " '".price2num($this->localtax1_tx)."',";
$sql.= " '".price2num($this->localtax2_tx)."',";
$sql.= " '".$this->localtax1_type."',";
$sql.= " '".$this->localtax2_type."',";
$sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
$sql.= " '".$this->product_type."',";
$sql.= " '".price2num($this->remise_percent)."',";
@ -3275,6 +3295,8 @@ class OrderLine extends CommonOrderLine
if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
if (empty($this->localtax2_tx)) $this->localtax2_tx=0;
if (empty($this->localtax1_type)) $this->localtax1_type=0;
if (empty($this->localtax2_type)) $this->localtax2_type=0;
if (empty($this->qty)) $this->qty=0;
if (empty($this->total_localtax1)) $this->total_localtax1=0;
if (empty($this->total_localtax2)) $this->total_localtax2=0;
@ -3303,6 +3325,8 @@ class OrderLine extends CommonOrderLine
$sql.= " , tva_tx=".price2num($this->tva_tx);
$sql.= " , localtax1_tx=".price2num($this->localtax1_tx);
$sql.= " , localtax2_tx=".price2num($this->localtax2_tx);
$sql.= " , localtax1_type='".$this->localtax1_type."'";
$sql.= " , localtax2_type='".$this->localtax2_type."'";
$sql.= " , qty=".price2num($this->qty);
$sql.= " , subprice=".price2num($this->subprice)."";
$sql.= " , remise_percent=".price2num($this->remise_percent)."";

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -125,13 +126,12 @@ $sql.= ' WHERE c.fk_soc = s.rowid';
$sql.= ' AND c.entity = '.$conf->entity;
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($sref)
{
$sql.= " AND c.ref LIKE '%".$db->escape($sref)."%'";
if ($sref) {
$sql .= natural_search('c.ref', $sref);
}
if ($sall)
{
$sql.= " AND (c.ref LIKE '%".$db->escape($sall)."%' OR c.note LIKE '%".$db->escape($sall)."%')";
$sql .= natural_search(array('c.ref', 'c.note_private'), $sall);
}
if ($viewstatut <> '')
{
@ -187,7 +187,7 @@ else if ($deliveryyear > 0)
}
if (!empty($snom))
{
$sql.= ' AND s.nom LIKE \'%'.$db->escape($snom).'%\'';
$sql .= natural_search('s.nom', $snom);
}
if (!empty($sref_client))
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Andreu Bisquerra Gaya <jove@bisquerra.com>
@ -96,9 +96,8 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load('bills');
$langs->load('products');
$langs->load('main');
@ -127,7 +126,7 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
$lineid = GETPOST('lineid','int');
$userid = GETPOST('userid','int');
$search_ref = GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref');
$closeOrders = GETPOST('autocloseorders') != '' ? true : false;
$closeOrders = GETPOST('autocloseorders') ? true : false;
// Security check
$fieldid = GETPOST('ref','alpha')?'facnumber':'rowid';
@ -214,8 +213,9 @@ if (($action == 'create' || $action == 'add') && empty($mesgs))
$result=$objectsrc->fetch($orders_id[$ii]);
if ($result > 0)
{
if($closeOrders) {
$objectsrc->classer_facturee();
if ($closeOrders)
{
$objectsrc->classifyBilled();
$objectsrc->setStatut(3);
}
$lines = $objectsrc->lines;

View File

@ -71,7 +71,7 @@ if ($_POST["action"] == 'add')
$account->currency_code = trim($_POST["account_currency_code"]);
$account->state_id = $_POST["account_departement_id"];
$account->state_id = $_POST["account_state_id"];
$account->country_id = $_POST["account_country_id"];
$account->min_allowed = $_POST["account_min_allowed"];

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -75,11 +76,11 @@ if (trim($search_ref) != '')
}
if (trim($search_company) != '')
{
$sql.= ' AND d.societe LIKE \'%'.$db->escape(trim($search_company)) . '%\'';
$sql .= natural_search('d.societe', $search_company);
}
if (trim($search_name) != '')
{
$sql.= ' AND d.lastname LIKE \'%'.$db->escape(trim($search_name)) . '%\' OR d.firstname LIKE \'%'.$db->escape(trim($search_name)) . '%\'';
$sql .= natural_search(array('d.lastname', 'd.firstname'), $search_name);
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);

View File

@ -8,7 +8,8 @@
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -874,14 +875,18 @@ else if ($action == 'add' && $user->rights->facture->creer)
if ($id > 0)
{
//If deposit invoice
if ($_POST['type'] == 3) {
// If deposit invoice
if ($_POST['type'] == 3)
{
$typeamount=GETPOST('typedeposit','alpha');
$valuedeposit=GETPOST('valuedeposit','int');
if ($typeamount=='amount') {
if ($typeamount=='amount')
{
$amountdeposit=$valuedeposit;
}else {
}
else
{
$amountdeposit=0;
dol_include_once('/'.$element.'/class/'.$subelement.'.class.php');
@ -889,19 +894,20 @@ else if ($action == 'add' && $user->rights->facture->creer)
$classname = ucfirst($subelement);
$srcobject = new $classname($db);
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit line");
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit lines");
$result=$srcobject->fetch($object->origin_id);
if ($result > 0)
{
$totalamount=0;
$lines = $srcobject->lines;
$num=count($lines);
for ($i=0;$i<$num;$i++)
$numlines=count($lines);
for ($i=0; $i<$numlines; $i++)
{
$totalamount=+$lines[$i]->subprice;
$totalamount += $lines[$i]->subprice;
}
if ($totalamount!=0) {
if ($totalamount!=0)
{
$amountdeposit=($totalamount*$valuedeposit)/100;
}
}
@ -1582,9 +1588,18 @@ else if ($action == 'down' && $user->rights->facture->creer)
exit;
}
// Link invoice to order
if (GETPOST('linkedOrder'))
{
$object->fetch($id);
$object->fetch_thirdparty();
$result=$object->add_object_linked('commande',GETPOST('linkedOrder'));
}
/*
* Add file in email form
*/
*/
if (GETPOST('addfile'))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1599,7 +1614,7 @@ if (GETPOST('addfile'))
/*
* Remove file in email form
*/
*/
if (! empty($_POST['removedfile']))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1615,7 +1630,7 @@ if (! empty($_POST['removedfile']))
/*
* Send mail
*/
*/
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
{
$langs->load('mails');
@ -1789,7 +1804,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
/*
* Generate document
*/
*/
else if ($action == 'builddoc') // En get ou en post
{
$object->fetch($id);
@ -1954,6 +1969,16 @@ $now=dol_now();
llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
print '
<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#linktoorder").click(function() {
jQuery("#commande").toggle();
});
});
</script>
';
/*********************************************************************
*
@ -2018,7 +2043,7 @@ if ($action == 'create')
$remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
//Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options=$objectsrc->array_options;
@ -2057,8 +2082,7 @@ if ($action == 'create')
// Ref
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$langs->trans('Draft').'</td></tr>';
// Tiers
print '<tr>';
// Thirdparty
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
if($soc->id > 0)
{
@ -2075,7 +2099,7 @@ if ($action == 'create')
}
print '</tr>'."\n";
// Factures predefinies
// Predefined invoices
if (empty($origin) && empty($originid) && $socid > 0)
{
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
@ -2182,10 +2206,13 @@ if ($action == 'create')
print '</td><td valign="middle" class="nowrap">';
$desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
print '<table class="nobordernopadding"><tr><td>'.$desc.'</td>';
if (($origin=='propal') || ($origin=='commande')) {
print '<td><select name="typedeposit"><option value="amount">'.$langs->trans('FixAmount').'</option>';
print '<option value="variable">'.$langs->trans('VarAmount').'</option></select></td>';
print '<td>'.$langs->trans('Value').':<input type="text" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit','int').'"/>';
if (($origin=='propal') || ($origin=='commande'))
{
print '<td class="nowrap" style="padding-left: 5px">';
$arraylist=array('amount'=>'FixAmount','variable'=>'VarAmount');
print $form->selectarray('typedeposit',$arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
print '</td>';
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit','int').'"/>';
}
print '</td></tr></table>';
print '</td></tr>'."\n";
@ -2454,6 +2481,7 @@ if ($action == 'create')
print '</table>';
}
print '<br>';
}
else if ($id > 0 || ! empty($ref))
{
@ -2605,13 +2633,22 @@ else if ($id > 0 || ! empty($ref))
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
$formproduct=new FormProduct($db);
$label=$object->type==2?$langs->trans("SelectWarehouseForStockIncrease"):$langs->trans("SelectWarehouseForStockDecrease");
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type==2?$langs->trans("WarehouseForStockIncrease", current($warehouse_array)):$langs->trans("WarehouseForStockDecrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
} else {
$label = $object->type==2?$langs->trans("SelectWarehouseForStockIncrease"):$langs->trans("SelectWarehouseForStockDecrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1);
}
$formquestion=array(
//'text' => $langs->trans("ConfirmClone"),
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value));
}
if ($object->type != 2 && $object->total_ttc < 0) // Can happen only if $conf->global->FACTURE_ENABLE_NEGATIVE is on
{
@ -2639,13 +2676,22 @@ else if ($id > 0 || ! empty($ref))
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
$formproduct=new FormProduct($db);
$label=$object->type==2?$langs->trans("SelectWarehouseForStockDecrease"):$langs->trans("SelectWarehouseForStockIncrease");
$warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) {
$label = $object->type==2?$langs->trans("WarehouseForStockDecrease", current($warehouse_array)):$langs->trans("WarehouseForStockIncrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
} else {
$label=$object->type==2?$langs->trans("SelectWarehouseForStockDecrease"):$langs->trans("SelectWarehouseForStockIncrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1);
}
$formquestion=array(
//'text' => $langs->trans("ConfirmClone"),
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1)));
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value));
}
$formconfirm=$form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id,$langs->trans('UnvalidateBill'),$text,'confirm_modif',$formquestion,"yes",1);
@ -3700,74 +3746,64 @@ else if ($id > 0 || ! empty($ref))
// Linked object block
$somethingshown=$object->showLinkedObjectBlock();
if (empty($somethingshown) && $object->statut > 0)
{
print '<a href="#" onClick="lier_commande(commande)">'.$langs->trans('LinkedOrder').'</a>';
print '<div id="commande" style="display:none">';
{
print '<br><a href="#" id="linktoorder">'.$langs->trans('LinkedOrder').'</a>';
print '<div id="commande" style="display:none">';
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande as c";
$sql.= ' WHERE c.fk_soc = '.$soc->id.'';
$result = $db->query($sql);
if ($result)
$resqlorderlist = $db->query($sql);
if ($resqlorderlist)
{
$num = $db->num_rows($result);
$num = $db->num_rows($resqlorderlist);
$i = 0;
print_titre($langs->trans("LinkedOrder"));
print '<table><tr class="liste_titre">';
print '<td class="nowrap"></td>';
print '<td align="center">'.$langs->trans("Ref").'</td>';
print '<td align="left">'.$langs->trans("RefCustomer").'</td>';
print '<td align="left">'.$langs->trans("AmountHTShort").'</td>';
print '<td align="left">'.$langs->trans("Company").'</td>
</tr>';
print '<form action=" " method="post" name="LinkedOrder">';
print '<form action="" method="POST" name="LinkedOrder">';
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td class="nowrap"></td>';
print '<td align="center">'.$langs->trans("Ref").'</td>';
print '<td align="left">'.$langs->trans("RefCustomer").'</td>';
print '<td align="left">'.$langs->trans("AmountHTShort").'</td>';
print '<td align="left">'.$langs->trans("Company").'</td>';
print '</tr>';
while ($i < $num)
{
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resqlorderlist);
if ($objp->socid == $soc->id)
{
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td aling="left">';
print '<input type="radio" name="linkedOrder" value='.$objp->rowid.'>';
print '<td align="center">'.$objp->ref.'</td>';
print '<td>'.$objp->ref_client.'</td>';
print '<td>'.price($objp->total_ht).'</td>';
print '<td>'.$objp->name.'</td>';
print '</td>';
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td aling="left">';
print '<input type="radio" name="linkedOrder" value='.$objp->rowid.'>';
print '<td align="center">'.$objp->ref.'</td>';
print '<td>'.$objp->ref_client.'</td>';
print '<td>'.price($objp->total_ht).'</td>';
print '<td>'.$objp->name.'</td>';
print '</td>';
print '</tr>';
}
$i++;
}
$i++;
}
print '</table>';
print '</br>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans('OK').'"></center>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans('ToLink').'"></center>';
print '</form>';
$db->free($resqlorderlist);
}
else
else
{
dol_print_error($db);
}
$result=$object->add_object_linked('commande',$_POST['linkedOrder']);
if($result>0)
{
echo '<meta http-equiv="refresh" content="0;URL=facture.php?facid='.$object->id.'">';
}
}
print '</div>';
}
print '</div>';
}
// Link for paypal payment
if (! empty($conf->paypal->enabled) && $object->statut != 0)
{
@ -3776,7 +3812,7 @@ else if ($id > 0 || ! empty($ref))
}
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
@ -3907,7 +3943,7 @@ else if ($id > 0 || ! empty($ref))
$formmail->show_form();
print '<br>';
}
}
}
else
{
@ -3919,20 +3955,4 @@ dol_htmloutput_mesg('',$mesgs);
llxFooter();
$db->close();
?>
<script>
function lier_commande(commande)
{
if(commande.style.display=='none')
{
commande.style.display='inline';
}
else
{
commande.style.display="none";
}
}
</script>
?>

View File

@ -52,7 +52,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -53,7 +53,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -95,7 +95,8 @@ class FactureRec extends Facture
// Clean parameters
$this->titre=trim($this->titre);
$this->usenewprice=empty($this->usenewprice)?0:$this->usenewprice;
$this->db->begin();
// Charge facture modele
@ -122,9 +123,9 @@ class FactureRec extends Facture
$sql.= ", usenewprice";
$sql.= ") VALUES (";
$sql.= "'".$this->titre."'";
$sql.= ", '".$facsrc->socid."'";
$sql.= ", ".$facsrc->socid;
$sql.= ", ".$conf->entity;
$sql.= ", ".$this->db->idate($now);
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ".(!empty($facsrc->amount)?$facsrc->amount:'0');
$sql.= ", ".(!empty($facsrc->remise)?$this->remise:'0');
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
@ -133,7 +134,7 @@ class FactureRec extends Facture
$sql.= ", ".(! empty($facsrc->fk_project)?"'".$facsrc->fk_project."'":"null");
$sql.= ", '".$facsrc->cond_reglement_id."'";
$sql.= ", '".$facsrc->mode_reglement_id."'";
$sql.= ", '".$this->usenewprice."'";
$sql.= ", ".$this->usenewprice;
$sql.= ")";
if ($this->db->query($sql))
@ -575,5 +576,28 @@ class FactureRec extends Facture
return $result;
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
* @return void
*/
function initAsSpecimen($option='')
{
global $user,$langs,$conf;
$now=dol_now();
$arraynow=dol_getdate($now);
$nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']);
parent::initAsSpecimen($option);
$this->usenewprice = 1;
}
}
?>

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
@ -923,7 +923,7 @@ class Facture extends CommonInvoice
$this->lines=array();
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.tva_tx, ';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.remise, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.rang, l.special_code,';
$sql.= ' l.date_start as date_start, l.date_end as date_end,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
@ -958,6 +958,8 @@ class Facture extends CommonInvoice
$line->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx;
$line->localtax1_type = $objp->localtax1_type;
$line->localtax2_type = $objp->localtax2_type;
$line->remise_percent = $objp->remise_percent;
$line->fk_remise_except = $objp->fk_remise_except;
$line->fk_product = $objp->fk_product;
@ -1974,6 +1976,8 @@ class Facture extends CommonInvoice
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_option=0)
{
global $mysoc;
$facid=$this->id;
dol_syslog(get_class($this)."::Addline facid=$facid,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type", LOG_DEBUG);
@ -2019,7 +2023,10 @@ class Facture extends CommonInvoice
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type);
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'',$localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -2066,6 +2073,8 @@ class Facture extends CommonInvoice
$this->line->total_tva= (($this->type==2||$qty<0)?-abs($total_tva):$total_tva);
$this->line->total_localtax1=(($this->type==2||$qty<0)?-abs($total_localtax1):$total_localtax1);
$this->line->total_localtax2=(($this->type==2||$qty<0)?-abs($total_localtax2):$total_localtax2);
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->total_ttc= (($this->type==2||$qty<0)?-abs($total_ttc):$total_ttc);
$this->line->special_code=$special_code;
$this->line->fk_parent_line=$fk_parent_line;
@ -2139,6 +2148,8 @@ class Facture extends CommonInvoice
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_option=0)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
global $mysoc;
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1, $txlocaltax2, $price_base_type, $info_bits, $type, $fk_parent_line", LOG_DEBUG);
@ -2165,7 +2176,10 @@ class Facture extends CommonInvoice
// Calculate total with, without tax and tax from qty, pu, remise_percent and txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type);
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type,'',$localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -2207,6 +2221,8 @@ class Facture extends CommonInvoice
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->remise_percent = $remise_percent;
$this->line->subprice = ($this->type==2?-abs($pu_ht):$pu_ht); // For credit note, unit price always negative, always positive otherwise
$this->line->date_start = $date_start;
@ -3305,6 +3321,8 @@ class FactureLigne extends CommonInvoiceLine
var $tva_tx; // Taux tva produit/service (example 19.6)
var $localtax1_tx; // Local tax 1
var $localtax2_tx; // Local tax 2
var $localtax1_type; // Local tax 1 type
var $localtax2_type; // Local tax 2 type
var $subprice; // P.U. HT (example 100)
var $remise_percent; // % de la remise ligne (example 20%)
var $fk_remise_except; // Link to line into llx_remise_except
@ -3451,6 +3469,8 @@ class FactureLigne extends CommonInvoiceLine
if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
if (empty($this->localtax2_tx)) $this->localtax2_tx=0;
if (empty($this->localtax1_type)) $this->localtax1_type=0;
if (empty($this->localtax2_type)) $this->localtax2_type=0;
if (empty($this->total_localtax1)) $this->total_localtax1=0;
if (empty($this->total_localtax2)) $this->total_localtax2=0;
if (empty($this->rang)) $this->rang=0;
@ -3475,7 +3495,8 @@ class FactureLigne extends CommonInvoiceLine
// Insertion dans base de la ligne
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet';
$sql.= ' (fk_facture, fk_parent_line, label, description, qty, tva_tx, localtax1_tx, localtax2_tx,';
$sql.= ' (fk_facture, fk_parent_line, label, description, qty,';
$sql.= ' tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql.= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,';
$sql.= ' date_start, date_end, fk_code_ventilation, ';
$sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
@ -3488,6 +3509,8 @@ class FactureLigne extends CommonInvoiceLine
$sql.= " ".price2num($this->tva_tx).",";
$sql.= " ".price2num($this->localtax1_tx).",";
$sql.= " ".price2num($this->localtax2_tx).",";
$sql.= " '".$this->localtax1_type."',";
$sql.= " '".$this->localtax2_type."',";
$sql.= ' '.(! empty($this->fk_product)?$this->fk_product:"null").',';
$sql.= " ".$this->product_type.",";
$sql.= " ".price2num($this->remise_percent).",";
@ -3615,6 +3638,8 @@ class FactureLigne extends CommonInvoiceLine
if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
if (empty($this->localtax2_tx)) $this->localtax2_tx=0;
if (empty($this->localtax1_type)) $this->localtax1_type=0;
if (empty($this->localtax2_type)) $this->localtax2_type=0;
if (empty($this->total_localtax1)) $this->total_localtax1=0;
if (empty($this->total_localtax2)) $this->total_localtax2=0;
if (empty($this->remise_percent)) $this->remise_percent=0;
@ -3647,6 +3672,8 @@ class FactureLigne extends CommonInvoiceLine
$sql.= ",tva_tx=".price2num($this->tva_tx)."";
$sql.= ",localtax1_tx=".price2num($this->localtax1_tx)."";
$sql.= ",localtax2_tx=".price2num($this->localtax2_tx)."";
$sql.= ",localtax1_type='".$this->localtax1_type."'";
$sql.= ",localtax2_type='".$this->localtax2_type."'";
$sql.= ",qty=".price2num($this->qty)."";
$sql.= ",date_start=".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null");
$sql.= ",date_end=".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null");

View File

@ -8,6 +8,7 @@
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -174,11 +175,11 @@ if ($filtre)
}
if ($search_ref)
{
$sql.= ' AND f.facnumber LIKE \'%'.$db->escape(trim($search_ref)).'%\'';
$sql .= natural_search('f.facnumber', $search_ref);
}
if ($search_societe)
{
$sql.= ' AND s.nom LIKE \'%'.$db->escape(trim($search_societe)).'%\'';
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_montant_ht)
{
@ -215,11 +216,11 @@ if (! $sall)
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.increment, f.total,f.tva, f.total_ttc,';
$sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,';
$sql.= ' s.nom, s.rowid';
$sql.= ' s.nom, s.rowid, f.note_private';
}
else
{
$sql.= ' AND (s.nom LIKE \'%'.$db->escape($sall).'%\' OR f.facnumber LIKE \'%'.$db->escape($sall).'%\' OR f.note LIKE \'%'.$db->escape($sall).'%\' OR fd.description LIKE \'%'.$db->escape($sall).'%\')';
$sql .= natural_search(array('s.nom', 'f.facnumber', 'f.note_public', 'fd.description'), $sall);
}
$sql.= ' ORDER BY ';
$listfield=explode(',',$sortfield);

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -112,7 +113,7 @@ else
if (GETPOST("search_account") > 0) $sql .=" AND b.fk_account=".GETPOST("search_account",'int');
if (GETPOST("search_paymenttype") != "") $sql .=" AND c.code='".GETPOST("search_paymenttype")."'";
if (GETPOST("search_amount")) $sql .=" AND p.amount=".price2num(GETPOST("search_amount"));
if (GETPOST("search_company")) $sql .=" AND s.nom LIKE '%".$db->escape(GETPOST("search_company"))."%'";
if (GETPOST("search_company")) $sql .= natural_search('s.nom', GETPOST('search_company'));
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);

View File

@ -576,8 +576,8 @@ class BonPrelevement extends CommonObject
/**
* Get invoice list
*
* @param $amounts If you want to get the amount of the order for each invoice
* @return array id of invoices
* @param int $amounts If you want to get the amount of the order for each invoice
* @return array Id of invoices
*/
private function getListInvoices($amounts=0)
{

View File

@ -14,9 +14,10 @@
// dolibarr_main_url_root
// This parameter defines the root URL of your Dolibarr index.php page.
// It must link to the htdocs directory htdocs.
// In most cases, this is autodetected but it still required to show full
// url bookmarks for some services (ie: agenda rss export url, ...) or
// when using Apache dir aliases (autodetect fails).
// In most cases, this is autodetected but it's still required
// * to show full url bookmarks for some services (ie: agenda rss export url, ...)
// * or when using Apache dir aliases (autodetect fails)
// * or when using nginx (autodetect fails)
// Examples:
// $dolibarr_main_url_root='http://localhost';
// $dolibarr_main_url_root='http://mydolibarrvirtualhost';

View File

@ -285,10 +285,10 @@ abstract class ActionsContactCardCommon
}
// Zip
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','departement_id'),6);
$this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip,'zipcode',array('town','selectcountry_id','state_id'),6);
// Town
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','departement_id'));
$this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town,'town',array('zipcode','selectcountry_id','state_id'));
if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id;
@ -432,9 +432,9 @@ abstract class ActionsContactCardCommon
$this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"];
$this->object->fk_departement = $_POST["departement_id"];
$this->object->fk_departement = $_POST["state_id"];
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$this->object->state_id = $_POST["departement_id"];
$this->object->state_id = $_POST["state_id"];
$this->object->phone_pro = $_POST["phone_pro"];
$this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"];

View File

@ -726,7 +726,7 @@ class Contact extends CommonObject
if (! $error)
{
// Remove category
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople = ".$rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople = ".$this->id;
dol_syslog(get_class($this)."::delete sql=".$sql);
$resql=$this->db->query($sql);
if (! $resql)
@ -734,8 +734,7 @@ class Contact extends CommonObject
$error++;
$this->error .= $this->db->lasterror();
$errorflag=-1;
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::delete error ".$errorflag." ".$this->error, LOG_ERR);
}
}
@ -907,20 +906,15 @@ class Contact extends CommonObject
}
/**
* Retourne le libelle du statut du contact
* Return label of contact status
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status
*/
function getLibStatut($mode)
{
return $this->LibStatut($this->statut,$mode);
}
function getLibStatutcontact()
{
return $this->LibStatutcontact($this->statut);
}
/**
* Renvoi le libelle d'un statut donne
@ -929,7 +923,7 @@ class Contact extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle
*/
function LibStatut($statut)
function LibStatut($statut,$mode)
{
global $langs;
@ -975,15 +969,10 @@ class Contact extends CommonObject
elseif ($statut==4) return '<span class="hideonsmartphone">'.$langs->trans('StatusContactValidatedShort').' </span>'.img_picto($langs->trans('StatusContactValidatedShort'),'statut4');
elseif ($statut==5) return '<span class="hideonsmartphone">'.$langs->trans('StatusContactValidatedShort').' </span>'.img_picto($langs->trans('StatusContactValidatedShort'),'statut5');
}
}
function LibStatutcontact($statut)
{
global $langs;
if ($statut==0) return '<span class="hideonsmartphone">'.$langs->trans('Disabled').' </span>'.img_picto($langs->trans('StatusContactDraftShort'),'statut0');
else return '<span class="hideonsmartphone">'.$langs->trans('Enabled').' </span>'.img_picto($langs->trans('StatusContactValidatedShort'),'statut1');
}
/**
* Return translated label of Public or Private
*
@ -1051,7 +1040,7 @@ class Contact extends CommonObject
$this->socid = $socids[$socid];
$this->statut=1;
}
/**
* Change status of a user
*

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
@ -739,7 +739,7 @@ else
// Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<td>';
print $object->getLibStatutcontact();
print $object->getLibStatut(5);
print '</td></tr>';
// Other attributes
@ -946,10 +946,10 @@ else
print nl2br($object->note);
print '</td></tr>';
// Statut
// Statut
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
print '<td>';
print $object->getLibStatutcontact();
print $object->getLibStatut(5);
print '</td>';
print '</tr>'."\n";
// Other attributes

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -148,21 +149,17 @@ else
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_lastname) // filter on lastname
{
$sql .= " AND p.lastname LIKE '%".$db->escape($search_lastname)."%'";
if ($search_lastname) { // filter on lastname
$sql .= natural_search('p.lastname', $search_lastname);
}
if ($search_firstname) // filter on firstname
{
$sql .= " AND p.firstname LIKE '%".$db->escape($search_firstname)."%'";
if ($search_firstname) { // filter on firstname
$sql .= natural_search('p.firstname', $search_firstname);
}
if ($search_societe) // filtre sur la societe
{
$sql .= " AND s.nom LIKE '%".$db->escape($search_societe)."%'";
if ($search_societe) { // filtre sur la societe
$sql .= natural_search('s.nom', $search_societe);
}
if (strlen($search_poste)) // filtre sur la societe
{
$sql .= " AND p.poste LIKE '%".$db->escape($search_poste)."%'";
if (strlen($search_poste)) { // filtre sur la societe
$sql .= natural_search('p.poste', $search_poste);
}
if (strlen($search_phone))
{
@ -206,11 +203,7 @@ else if ($type == "p") // filtre sur type
}
if ($sall)
{
// For natural search
$scrit = explode(' ', $sall);
foreach ($scrit as $crit) {
$sql .= " AND (p.lastname LIKE '%".$db->escape($crit)."%' OR p.firstname LIKE '%".$db->escape($crit)."%' OR p.email LIKE '%".$db->escape($crit)."%')";
}
$sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email'), $sall);
}
if (! empty($socid))
{

View File

@ -54,7 +54,7 @@ if (!$user->admin) accessforbidden();
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/admin_extrafields.inc.php';
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
@ -281,6 +281,7 @@ class Contrat extends CommonObject
*/
function validate($user)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
global $langs, $conf;
$error=0;
@ -314,8 +315,37 @@ class Contrat extends CommonObject
$result=$interface->run_triggers('CONTRACT_VALIDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
if (! $error)
{
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
// Rename of propal directory ($this->ref = old ref, $num = new ref)
// to not lose the linked files
$facref = dol_sanitizeFileName($this->ref);
$snumfa = dol_sanitizeFileName($num);
$dirsource = $conf->contract->dir_output.'/'.$facref;
$dirdest = $conf->contract->dir_output.'/'.$snumfa;
if (file_exists($dirsource))
{
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
if (@rename($dirsource, $dirdest))
{
dol_syslog("Rename ok");
// Deleting old PDF in new rep
dol_delete_file($conf->contract->dir_output.'/'.$snumfa.'/'.$facref.'*.*');
}
}
}
return 1;
return 1;
}
else
{
return -1;
}
}
else
{
@ -901,7 +931,7 @@ class Contrat extends CommonObject
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
{
global $user, $langs, $conf;
global $user, $langs, $conf, $mysoc;
dol_syslog(get_class($this)."::addline $desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type, $pu_ttc, $info_bits");
@ -936,12 +966,19 @@ class Contrat extends CommonObject
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1);
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,'', $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
$total_localtax1= $tabprice[9];
$total_localtax2= $tabprice[10];
$localtax1_type=$localtaxes_type[0];
$localtax2_type=$localtaxes_type[2];
// TODO A virer
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
$remise = 0;
@ -963,7 +1000,7 @@ class Contrat extends CommonObject
// Insertion dans la base
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet";
$sql.= " (fk_contrat, label, description, fk_product, qty, tva_tx,";
$sql.= " localtax1_tx, localtax2_tx, remise_percent, subprice,";
$sql.= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, remise_percent, subprice,";
$sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc,";
$sql.= " info_bits,";
$sql.= " price_ht, remise, fk_product_fournisseur_price, buy_price_ht";
@ -975,6 +1012,8 @@ class Contrat extends CommonObject
$sql.= " '".$txtva."',";
$sql.= " '".$txlocaltax1."',";
$sql.= " '".$txlocaltax2."',";
$sql.= " '".$localtax1_type."',";
$sql.= " '".$localtax2_type."',";
$sql.= " ".price2num($remise_percent).",".price2num($pu_ht).",";
$sql.= " ".price2num($total_ht).",".price2num($total_tva).",".price2num($total_localtax1).",".price2num($total_localtax2).",".price2num($total_ttc).",";
$sql.= " '".$info_bits."',";
@ -1043,7 +1082,7 @@ class Contrat extends CommonObject
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0)
{
global $user, $conf, $langs;
global $user, $conf, $langs, $mysoc;
// Nettoyage parametres
$qty=trim($qty);
@ -1075,12 +1114,19 @@ class Contrat extends CommonObject
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1);
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
$total_localtax1= $tabprice[9];
$total_localtax2= $tabprice[10];
$localtax1_type=$localtaxes_type[0];
$localtax2_type=$localtaxes_type[2];
// TODO A virer
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
$remise = 0;
@ -1108,6 +1154,8 @@ class Contrat extends CommonObject
$sql.= ",tva_tx='". price2num($tvatx)."'";
$sql.= ",localtax1_tx='". price2num($localtax1tx)."'";
$sql.= ",localtax2_tx='". price2num($localtax2tx)."'";
$sql.= ",localtax1_type='".$localtax1_type."'";
$sql.= ",localtax2_type='".$localtax2_type."'";
$sql.= ", total_ht='". price2num($total_ht)."'";
$sql.= ", total_tva='". price2num($total_tva)."'";
$sql.= ", total_localtax1='".price2num($total_localtax1)."'";
@ -1666,6 +1714,8 @@ class ContratLigne
var $tva_tx;
var $localtax1_tx;
var $localtax2_tx;
var $localtax1_type; // Local tax 1 type
var $localtax2_type; // Local tax 2 type
var $qty;
var $remise_percent;
var $remise;

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -79,9 +80,15 @@ $sql.= " WHERE c.fk_soc = s.rowid ";
$sql.= " AND c.entity = ".$conf->entity;
if ($socid) $sql.= " AND s.rowid = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($search_nom) $sql.= " AND s.nom LIKE '%".$db->escape($search_nom)."%'";
if ($search_contract) $sql.= " AND (".(is_numeric($search_contract)?"c.rowid = ".$db->escape($search_contract)." OR ":'')." c.ref LIKE '%".$db->escape($search_contract)."%')";
if ($sall) $sql.= " AND (s.nom LIKE '%".$db->escape($sall)."%' OR cd.label LIKE '%".$db->escape($sall)."%' OR cd.description LIKE '%".$db->escape($sall)."%')";
if ($search_nom) {
$sql .= natural_search('s.nom', $search_nom);
}
if ($search_contract) {
$sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract);
}
if ($sall) {
$sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall);
}
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut,";
$sql.= " s.nom, s.rowid";
$sql.= " ORDER BY $sortfield $sortorder";

View File

@ -17,7 +17,7 @@
*/
/**
* \file htdocs/core/admin_extrafields.inc.php
* \file htdocs/core/actions_extrafields.inc.php
* \brief Code for actions on extrafields admin pages
*/
@ -306,4 +306,4 @@ if ($action == 'delete')
}
}
?>
?>

View File

@ -0,0 +1,240 @@
<?php
/* Copyright (C) 2013 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/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/actions_sendmails.inc.php
* \brief Code for actions on sending mails from object page
*/
// TODO Include this include file into all class objects
// $id must be defined
// $actiontypecode must be defined
/*
* Add file in email form
*/
if (GETPOST('addfile'))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp user directory
$vardir=$conf->user->dir_output."/".$user->id;
$upload_dir_tmp = $vardir.'/temp';
dol_add_file_process($upload_dir_tmp,0,0);
$action='presend';
}
/*
* Remove file in email form
*/
if (! empty($_POST['removedfile']))
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Set tmp user directory
$vardir=$conf->user->dir_output."/".$user->id;
$upload_dir_tmp = $vardir.'/temp';
// TODO Delete only files that was uploaded from email form
dol_remove_file_process($_POST['removedfile'],0);
$action='presend';
}
/*
* Send mail
*/
if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
{
$langs->load('mails');
$subject='';$actionmsg='';$actionmsg2='';
$result=$object->fetch($id);
if (method_exists($object,"fetch_thirdparty") && $object->element != 'societe')
{
$result=$object->fetch_thirdparty();
$thirdparty=$object->thirdparty;
}
else if ($object->element == 'societe')
{
$thirdparty=$object;
}
else dol_print_error('','Use actions_sendmails.in.php for a type that is not supported');
if ($result > 0)
{
if ($_POST['sendto'])
{
// Recipient is provided into free text
$sendto = $_POST['sendto'];
$sendtoid = 0;
}
elseif ($_POST['receiver'] != '-1')
{
// Recipient was provided from combo list
if ($_POST['receiver'] == 'thirdparty') // Id of third party
{
$sendto = $thirdparty->email;
$sendtoid = 0;
}
else // Id du contact
{
$sendto = $thirdparty->contact_get_property($_POST['receiver'],'email');
$sendtoid = $_POST['receiver'];
}
}
if (dol_strlen($sendto))
{
$langs->load("commercial");
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
$replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>';
$message = $_POST['message'];
$sendtocc = $_POST['sendtocc'];
$deliveryreceipt = $_POST['deliveryreceipt'];
if ($action == 'send')
{
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message)
{
$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n";
$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message;
}
//$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
}
if ($action == 'relance')
{
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
if ($message) {
$actionmsg.=$langs->transnoentities('MailTopic').": ".$subject."\n";
$actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n";
$actionmsg.=$message;
}
//$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
}
// Create form object
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$attachedfiles=$formmail->get_attached_files();
$filepath = $attachedfiles['paths'];
$filename = $attachedfiles['names'];
$mimetype = $attachedfiles['mimes'];
// Send mail
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt,-1);
if ($mailfile->error)
{
$mesgs[]='<div class="error">'.$mailfile->error.'</div>';
}
else
{
$result=$mailfile->sendfile();
if ($result)
{
$error=0;
// Initialisation donnees
$object->sendtoid = $sendtoid;
$object->actiontypecode = $actiontypecode;
$object->actionmsg = $actionmsg; // Long text
$object->actionmsg2 = $actionmsg2; // Short text
$object->fk_element = $object->id;
$object->elementtype = $object->element;
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($db);
$result=$interface->run_triggers('THIRDPARTY_EMAILSENT',$object,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers
if ($error)
{
dol_print_error($db);
}
else
{
// Redirect here
// This avoid sending mail twice if going out and then back to page
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
setEventMessage($mesg);
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id);
exit;
}
}
else
{
$langs->load("other");
$mesg='<div class="error">';
if ($mailfile->error)
{
$mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
$mesg.='<br>'.$mailfile->error;
}
else
{
$mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
}
$mesg.='</div>';
setEventMessage($mesg,'warnings');
$action = 'presend';
}
}
/* }
else
{
$langs->load("other");
$mesgs[]='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').'</div>';
dol_syslog('Recipient email is empty');
}*/
}
else
{
$langs->load("errors");
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")),'warnings');
dol_syslog('Try to send email with no recipiend defined', LOG_WARNING);
$action = 'presend';
}
}
else
{
$langs->load("other");
setEventMessage($langs->trans('ErrorFailedToReadEntity',$object->element),'errors');
dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element);
$action = 'presend';
}
}
?>

View File

@ -116,7 +116,6 @@ if (! empty($_GET['zipcode']) || ! empty($_GET['town']))
$row_array['value'] = $row['town'];
$row_array['zipcode'] = $row['zip'];
}
$row_array['departement_id'] = $row['fk_county']; // deprecated
$row_array['selectcountry_id'] = $row['fk_country'];
$row_array['state_id'] = $row['fk_county'];

View File

@ -83,17 +83,29 @@ class box_graph_invoices_permonth extends ModeleBoxes
if ($user->rights->facture->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='customer';
$userid=0;
@ -191,7 +203,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");

View File

@ -82,17 +82,29 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if ($user->rights->fournisseur->facture->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='supplier';
$userid=0;
@ -190,7 +202,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");

View File

@ -83,17 +83,29 @@ class box_graph_orders_permonth extends ModeleBoxes
if ($user->rights->commande->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='customer';
$userid=0;
@ -191,7 +203,7 @@ class box_graph_orders_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");

View File

@ -82,17 +82,29 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
if ($user->rights->fournisseur->commande->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='supplier';
$userid=0;
@ -190,7 +202,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");

View File

@ -21,7 +21,7 @@
* \brief Box to show graph of invoices per month
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
/**
* Class to manage the box to show last invoices
@ -82,20 +82,33 @@ class box_graph_product_distribution extends ModeleBoxes
'target'=>'none' // Set '' to get target="_blank"
);
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_showinvoicenb='DOLUSERCOOKIE_param'.$this->boxcode.'showinvoicenb';
$param_showpropalnb='DOLUSERCOOKIE_param'.$this->boxcode.'showpropalnb';
$param_showordernb='DOLUSERCOOKIE_param'.$this->boxcode.'showordernb';
$showinvoicenb=GETPOST($param_showinvoicenb,'alpha',4);
$showpropalnb=GETPOST($param_showpropalnb,'alpha',4);
$showordernb=GETPOST($param_showordernb,'alpha',4);
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_showinvoicenb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showinvoicenb';
$param_showpropalnb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showpropalnb';
$param_showordernb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showordernb';
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$year=GETPOST($param_year,'int');
$showinvoicenb=GETPOST($param_showinvoicenb,'alpha');
$showpropalnb=GETPOST($param_showpropalnb,'alpha');
$showordernb=GETPOST($param_showordernb,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$year=$tmparray['year'];
$showinvoicenb=$tmparray['showinvoicenb'];
$showpropalnb=$tmparray['showpropalnb'];
$showordernb=$tmparray['showordernb'];
}
if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb=1; $showinvoicenb=1; $showordernb=1; }
if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb=0;
if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) $showpropalnb=0;
if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb=0;
$nowarray=dol_getdate(dol_now(),true);
$year=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($year)) $year=$nowarray['year'];
$nbofgraph=0;
if ($showinvoicenb) $nbofgraph++;
@ -111,7 +124,6 @@ class box_graph_product_distribution extends ModeleBoxes
if (! empty($conf->facture->enabled) && ! empty($user->rights->facture->lire))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$WIDTH=($nbofgraph >= 2 || ! empty($conf->dol_optimize_smallscreen))?'160':'320';
$HEIGHT='192';
@ -301,7 +313,7 @@ class box_graph_product_distribution extends ModeleBoxes
$stringtoshow.='<div class="center hideobject" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_showinvoicenb.','.$param_showpropalnb.','.$param_showordernb.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,showinvoicenb,showpropalnb,showordernb">';
if (! empty($conf->facture->enabled) || ! empty($user->rights->facture->lire))
{
$stringtoshow.='<input type="checkbox" name="'.$param_showinvoicenb.'"'.($showinvoicenb?' checked="true"':'').'> '.$langs->trans("ForCustomersInvoices");

View File

@ -83,17 +83,29 @@ class box_graph_propales_permonth extends ModeleBoxes
if ($user->rights->propal->lire)
{
$param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year';
$param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb';
$param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot';
$param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
$param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb';
$param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
$shownb=GETPOST($param_shownb,'alpha',4);
$showtot=GETPOST($param_showtot,'alpha',4);
if (GETPOST('DOL_AUTOSET_COOKIE'))
{
$endyear=GETPOST($param_year,'int');
$shownb=GETPOST($param_shownb,'alpha');
$showtot=GETPOST($param_showtot,'alpha');
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true);
$endyear=$tmparray['year'];
$shownb=$tmparray['shownb'];
$showtot=$tmparray['showtot'];
}
if (empty($shownb) && empty($showtot)) $showtot=1;
$nowarray=dol_getdate(dol_now(),true);
$endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']);
if (empty($endyear)) $endyear=$nowarray['year'];
$startyear=$endyear-1;
$mode='customer';
$userid=0;
@ -196,7 +208,7 @@ class box_graph_propales_permonth extends ModeleBoxes
$stringtoshow.='<div class="center hideobject divboxfilter" id="idfilter'.$this->boxcode.'">'; // hideobject is to start hidden
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="'.$param_year.','.$param_shownb.','.$param_showtot.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfProposalsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfProposalsByMonthHT");

View File

@ -79,7 +79,7 @@ class box_members extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedMembers",$max));
if ($user->rights->societe->lire)
if ($user->rights->adherent->lire)
{
$sql = "SELECT a.rowid, a.lastname, a.firstname, a.societe as company, a.fk_soc,";
$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";

View File

@ -962,8 +962,11 @@ class CMailFile
$this->html_images[$i]["name"] = $img;
// Content type
$ext = preg_replace('/^.*\.(\w{3,4})$/e', 'strtolower("$1")', $img);
$this->html_images[$i]["content_type"] = $this->image_types[$ext];
if (preg_match('/^.+\.(\w{3,4})$/', $img, $reg))
{
$ext=strtolower($reg[1]);
$this->html_images[$i]["content_type"] = $this->image_types[$ext];
}
// cid
$this->html_images[$i]["cid"] = dol_hash(uniqid(time()));
@ -1076,4 +1079,4 @@ class CMailFile
}
}
?>
?>

View File

@ -247,10 +247,20 @@ abstract class CommonDocGenerator
$array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement),
$array_key.'_payment_term_code'=>$object->cond_reglement_code,
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
$array_key.'_total_ht'=>price($object->total_ht),
$array_key.'_total_vat'=>price($object->total_tva),
$array_key.'_total_ttc'=>price($object->total_ttc),
$array_key.'_total_discount_ht' => price($object->getTotalDiscount()),
$array_key.'_total_ht_locale'=>price($object->total_ht,0,$outputlangs),
$array_key.'_total_vat_locale'=>price($object->total_tva,0,$outputlangs),
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1,0,$outputlangs),
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2,0,$outputlangs),
$array_key.'_total_ttc_locale'=>price($object->total_ttc,0,$outputlangs),
$array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(),0,$outputlangs),
$array_key.'_total_ht'=>price2num($object->total_ht),
$array_key.'_total_vat'=>price2num($object->total_tva),
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
$array_key.'_total_ttc'=>price2num($object->total_ttc),
$array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()),
$array_key.'_vatrate'=>vatrate($object->tva),
$array_key.'_note_private'=>$object->note,
$array_key.'_note'=>$object->note_public,

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
@ -1471,21 +1471,23 @@ abstract class CommonObject
/**
* Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines).
* Must be called at end of methods addline, updateline.
* Must be called at end of methods addline or updateline.
*
* @param int $exclspec Exclude special product (product_type=9)
* @param int $roundingadjust -1=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or 0), 0=Force use total of rounding, 1=Force use rounding of total
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
* @param Societe $seller If roundingadjust is 0, it means we recalculate total for lines before calculating total for object. For this, we need seller object.
* @return int <0 if KO, >0 if OK
*/
function update_price($exclspec=0,$roundingadjust=-1,$nodatabaseupdate=0)
function update_price($exclspec=0,$roundingadjust=-1,$nodatabaseupdate=0,$seller='')
{
global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
if ($roundingadjust < 0 && isset($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)) $roundingadjust=$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND;
if ($roundingadjust < 0) $roundingadjust=0;
$forcedroundingmode=$roundingadjust;
if ($forcedroundingmode < 0 && isset($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)) $forcedroundingmode=$conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND;
if ($forcedroundingmode < 0) $forcedroundingmode=0;
$error=0;
@ -1493,10 +1495,15 @@ abstract class CommonObject
$fieldtva='total_tva';
$fieldlocaltax1='total_localtax1';
$fieldlocaltax2='total_localtax2';
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='tva';
$fieldup='subprice';
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
{
$fieldtva='tva';
$fieldup='pu_ht';
}
$sql = 'SELECT rowid, qty, total_ht, '.$fieldtva.' as total_tva, total_ttc, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2,';
$sql.= ' tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type';
$sql = 'SELECT rowid, qty, '.$fieldup.' as up, remise_percent, total_ht, '.$fieldtva.' as total_tva, total_ttc, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2,';
$sql.= ' tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
if ($exclspec)
@ -1526,7 +1533,26 @@ abstract class CommonObject
{
$obj = $this->db->fetch_object($resql);
$this->total_ht += $obj->total_ht; // The only field visible at line level
// By default, no adjustement is required ($forcedroundingmode = -1)
if ($forcedroundingmode == 0) // Check if we need adjustement onto line for vat
{
$localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx);
$tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array);
$diff=price2num($tmpcal[1] - $obj->total_tva, 'MT', 1);
if ($diff)
{
if (abs($diff) > 0.1) { dol_syslog('','A rounding difference was detected', LOG_WARNING); }
$sqlfix="UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".$tmpcal[1].", total_ttc = ".$tmpcal[2]." WHERE rowid = ".$obj->rowid;
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the vat and total_ttc by running sqlfix = ".$sqlfix);
$resqlfix=$this->db->query($sqlfix);
if (! $resqlfix) dol_print_error($this->db,'Failed to update line');
$obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2];
//
}
}
$this->total_ht += $obj->total_ht; // The only field visible at end of line detail
$this->total_tva += $obj->total_tva;
$this->total_localtax1 += $obj->total_localtax1;
$this->total_localtax2 += $obj->total_localtax2;
@ -1535,17 +1561,17 @@ abstract class CommonObject
$total_tva_by_vats[$obj->vatrate] += $obj->total_tva;
$total_ttc_by_vats[$obj->vatrate] += $obj->total_ttc;
if ($roundingadjust) // Check if we need adjustement onto line for vat
if ($forcedroundingmode == 1) // Check if we need adjustement onto line for vat
{
$tmpvat=price2num($total_ht_by_vats[$obj->vatrate] * $obj->vatrate / 100, 'MT', 1);
$diff=price2num($total_tva_by_vats[$obj->vatrate]-$tmpvat, 'MT', 1);
//print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."<br>\n";
if ($diff)
{
if ($diff > 0.1) { dol_print_error('','A rounding difference was detected but is to high to be corrected'); exit; }
if (abs($diff) > 0.1) { dol_syslog('','A rounding difference was detected but is too high to be corrected', LOG_WARNING); exit; }
$sqlfix="UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".($obj->total_tva - $diff).", total_ttc = ".($obj->total_ttc - $diff)." WHERE rowid = ".$obj->rowid;
//print 'We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". Run sqlfix = ".$sqlfix."<br>\n";
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". Run sqlfix = ".$sqlfix);
dol_syslog('We found a difference of '.$diff.' for line rowid = '.$obj->rowid.". We fix the vat and total_ttc by running sqlfix = ".$sqlfix);
$resqlfix=$this->db->query($sqlfix);
if (! $resqlfix) dol_print_error($this->db,'Failed to update line');
$this->total_tva -= $diff;
@ -3092,7 +3118,7 @@ abstract class CommonObject
if (empty($line->pa_ht) && isset($line->fk_fournprice) && !$force_price) {
$product = new ProductFournisseur($this->db);
if ($product->fetch_product_fournisseur_price($line->fk_fournprice))
$line->pa_ht = $product->fourn_unitprice;
$line->pa_ht = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100);
if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == "2" && $product->fourn_unitcharges > 0)
$line->pa_ht += $product->fourn_unitcharges;
}
@ -3223,16 +3249,23 @@ abstract class CommonObject
print '</table>';
}
/**
* Overwrite magic function to solve problem of cloning object that are kept as references
*
* @return void
*/
function __clone()
{
// Force a copy of this->lines, otherwise it will point to same object.
if (isset($this->lines) && is_array($this->lines))
{
for($i=0; $i < count($this->lines); $i++)
$nboflines=count($this->lines);
for($i=0; $i < $nboflines; $i++)
{
$this->lines[$i] = dol_clone($this->lines[$i]);
}
}
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -131,8 +131,20 @@ class HookManager
// Define type of hook ('output', 'returnvalue' or 'addreplace'). 'addreplace' should be type for all hooks. 'output' and 'returnvalue' are deprecated.
$hooktype='output';
if (preg_match('/^pdf_/',$method)) $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are returnvalue hooks. When there is 2 hooks of this type, only last one win.
if (in_array($method,array('addStatisticLine','doActions','formObjectOptions','formattachOptions','formBuilddocLineOptions','moveUploadedFile','pdf_writelinedesc','paymentsupplierinvoices',
'printSearchForm'))) $hooktype='addreplace';
if (in_array(
$method,
array(
'addStatisticLine',
'doActions',
'formObjectOptions',
'formattachOptions',
'formBuilddocLineOptions',
'moveUploadedFile',
'pdf_writelinedesc',
'paymentsupplierinvoices',
'printSearchForm'
)
)) $hooktype='addreplace';
// Loop on each hook to qualify modules that declared context
$modulealreadyexecuted=array();

View File

@ -1775,8 +1775,8 @@ class Form
{
$opt.= price($objp->fprice,1,$langs,0,0,-1,$conf->currency)."/".$objp->quantity;
$outval.= price($objp->fprice,0,$langs,0,0,-1,$conf->currency)."/".$objp->quantity;
$opt.= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
$outval.= $langs->transnoentities("Units");
$opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding
$outval.= ' '.$langs->transnoentities("Units");
}
if ($objp->quantity >= 1)

View File

@ -191,7 +191,7 @@ class FormCompany
* @param string $htmlname Id of department
* @return void
*/
function select_departement($selected='',$country_codeid=0, $htmlname='departement_id')
function select_departement($selected='',$country_codeid=0, $htmlname='state_id')
{
print $this->select_state($selected,$country_codeid, $htmlname);
}
@ -208,7 +208,7 @@ class FormCompany
* @param string $htmlname Id of department
* @return string String with HTML select
*/
function select_state($selected='',$country_codeid=0, $htmlname='departement_id')
function select_state($selected='',$country_codeid=0, $htmlname='state_id')
{
global $conf,$langs,$user;

View File

@ -46,8 +46,8 @@ class FormMail
var $withsubstit; // Show substitution array
var $withfrom;
var $withto;
var $withtofree;
var $withto; // Show recipient emails
var $withtofree; // Show free text for recipient emails
var $withtocc;
var $withtoccc;
var $withtopic;
@ -432,7 +432,7 @@ class FormMail
if (! empty($this->withtocc) && is_array($this->withtocc))
{
$out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receivercc", $this->withto, GETPOST("receivercc"), 1);
$out.= $form->selectarray("receivercc", $this->withtocc, GETPOST("receivercc"), 1);
}
}
$out.= "</td></tr>\n";
@ -454,7 +454,7 @@ class FormMail
if (! empty($this->withtoccc) && is_array($this->withtoccc))
{
$out.= " ".$langs->trans("or")." ";
$out.= $form->selectarray("receiverccc", $this->withto, GETPOST("receiverccc"), 1);
$out.= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1);
}
}
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
@ -493,7 +493,7 @@ class FormMail
}
else
{
$out.= '<input type="text" size="60" id="subject" name="subject" value="'. (isset($_POST["subject"])?$_POST["subject"]:$this->withtopic) .'" />';
$out.= '<input type="text" size="60" id="subject" name="subject" value="'. (isset($_POST["subject"])?$_POST["subject"]:(is_numeric($this->withtopic)?'':$this->withtopic)) .'" />';
}
$out.= "</td></tr>\n";
}

View File

@ -360,20 +360,20 @@ class FormOther
$moreforfilter.='<option value="">&nbsp;</option>';
// Get list of users allowed to be viewed
$sql_usr = "SELECT u.rowid, u.lastname as name, u.statut, u.firstname, u.login";
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql_usr.= " WHERE u.entity IN (0,".$conf->entity.")";
if (empty($user->rights->user->user->lire)) $sql_usr.=" AND u.fk_societe = ".($user->societe_id?$user->societe_id:0);
// Add existing sales representatives of company
// Add existing sales representatives of thirdparty of external user
if (empty($user->rights->user->user->lire) && $user->societe_id)
{
$sql_usr.=" UNION ";
$sql_usr.= "SELECT u2.rowid, u2.name as name, u2.firstname, u2.login";
$sql_usr.= "SELECT u2.rowid, u2.lastname, u2.firstname, u2.statut, u2.login";
$sql_usr.= " FROM ".MAIN_DB_PREFIX."user as u2, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql_usr.= " WHERE u2.entity IN (0,".$conf->entity.")";
$sql_usr.= " AND u2.rowid = sc.fk_user AND sc.fk_soc=".$user->societe_id;
}
$sql_usr.= " ORDER BY name ASC";
$sql_usr.= " ORDER BY lastname ASC";
//print $sql_usr;exit;
$resql_usr = $this->db->query($sql_usr);
@ -386,7 +386,7 @@ class FormOther
if ($obj_usr->rowid == $selected) $moreforfilter.=' selected="selected"';
$moreforfilter.='>';
$moreforfilter.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->name);
$moreforfilter.=dolGetFirstLastname($obj_usr->firstname,$obj_usr->lastname);
// Complete name with more info
$moreinfo=0;
if (! empty($conf->global->MAIN_SHOW_LOGIN))
@ -1084,6 +1084,68 @@ class FormOther
}
/**
* Return a HTML select list of bank accounts
*
* @param string $htmlname Name of select zone
* @param string $dictionnarytable Dictionnary table
* @param string $keyfield Field for key
* @param string $labelfield Label field
* @param string $selected Selected value
* @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries.
* @return void
*/
function select_dictionnary($htmlname,$dictionnarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0)
{
global $langs, $conf;
$langs->load("admin");
$sql = "SELECT rowid, ".$keyfield.", ".$labelfield;
$sql.= " FROM ".MAIN_DB_PREFIX.$dictionnarytable;
$sql.= " ORDER BY ".$labelfield;
dol_syslog(get_class($this)."::select_dictionnary sql=".$sql);
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
if ($num)
{
print '<select id="select'.$htmlname.'" class="flat selectdictionnary" name="'.$htmlname.'"'.($moreattrib?' '.$moreattrib:'').'>';
if ($useempty == 1 || ($useempty == 2 && $num > 1))
{
print '<option value="-1">&nbsp;</option>';
}
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
if ($selected == $obj->rowid || $selected == $obj->$keyfield)
{
print '<option value="'.$obj->$keyfield.'" selected="selected">';
}
else
{
print '<option value="'.$obj->$keyfield.'">';
}
print $obj->$labelfield;
print '</option>';
$i++;
}
print "</select>";
}
else
{
print $langs->trans("DictionnaryEmpty");
}
}
else {
dol_print_error($this->db);
}
}
}
?>

View File

@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2013 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
@ -17,102 +16,11 @@
*/
/**
* \file htdocs/core/login/functions_myopenid.php
* \file htdocs/core/class/openid.class.php
* \ingroup core
* \brief Authentication functions for OpenId mode
* \brief Class to manage authentication with OpenId
*/
/**
* Check validity of user/password/entity
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
*
* @param string $usertotest Login
* @param string $passwordtotest Password
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
* @return string Login if OK, '' if KO
*/
function check_user_password_myopenid($usertotest,$passwordtotest,$entitytotest)
{
global $_POST,$db,$conf,$langs;
dol_syslog("functions_dolibarr::check_user_password_myopenid usertotest=".$usertotest);
$login='';
// Get identity from user and redirect browser to OpenID Server
if (isset($_POST['username']))
{
$openid = new SimpleOpenID();
$openid->SetIdentity($_POST['username']);
$protocol = ($conf->file->main_force_https ? 'https://' : 'http://');
$openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]);
$openid->SetRequiredFields(array('email','fullname'));
$_SESSION['dol_entity'] = $_POST["entity"];
//$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone'));
if ($openid->GetOpenIDServer())
{
$openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script
$openid->Redirect(); // This will redirect user to OpenID Server
}
else
{
$error = $openid->GetError();
return false;
}
return false;
}
// Perform HTTP Request to OpenID server to validate key
elseif($_GET['openid_mode'] == 'id_res')
{
$openid = new SimpleOpenID();
$openid->SetIdentity($_GET['openid_identity']);
$openid_validation_result = $openid->ValidateWithServer();
if ($openid_validation_result == true)
{
// OK HERE KEY IS VALID
$sql ="SELECT login";
$sql.=" FROM ".MAIN_DB_PREFIX."user";
$sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'";
$sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")";
dol_syslog("functions_dolibarr::check_user_password_myopenid sql=".$sql);
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
if ($obj)
{
$login=$obj->login;
}
}
}
else if($openid->IsError() == true)
{
// ON THE WAY, WE GOT SOME ERROR
$error = $openid->GetError();
return false;
}
else
{
// Signature Verification Failed
//echo "INVALID AUTHORIZATION";
return false;
}
}
else if ($_GET['openid_mode'] == 'cancel')
{
// User Canceled your Request
//echo "USER CANCELED REQUEST";
return false;
}
return $login;
}
/**
* Class to manage OpenID
*/
@ -416,9 +324,22 @@ class SimpleOpenID
return $ret;
}
function GetOpenIDServer()
/**
* Get openid server
*
* @param string $url Url to found endpoint
* @return string Endpoint
*/
function GetOpenIDServer($url='')
{
$response = $this->CURL_Request($this->openid_url_identity);
global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
$response = getURLContent($url);
list($servers, $delegates) = $this->HTML2OpenIDServer($response);
if (count($servers) == 0){
$this->ErrorStore('OPENID_NOSERVERSFOUND');
@ -517,6 +438,61 @@ class SimpleOpenID
return false;
}
}
/**
* Get XRDS response and set possible servers.
*
* @param string $url Url of endpoint to request
* @return string First endpoint OpenID server found. False if it failed to found.
*/
function sendDiscoveryRequestToGetXRDS($url='')
{
global $conf;
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
if (empty($url)) $url=$conf->global->MAIN_AUTHENTICATION_OPENID_URL;
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS get XRDS');
$addheaders=array('Accept: application/xrds+xml');
$response = getURLContent($url, 'GET', '', 1, $addheaders);
/* response should like this:
<?xml version="1.0" encoding="UTF-8"?>
<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">
<XRD>
<Service priority="0">
<Type>http://specs.openid.net/auth/2.0/server</Type>
<Type>http://openid.net/srv/ax/1.0</Type>
...
<URI>https://www.google.com/accounts/o8/ud</URI>
</Service>
</XRD>
</xrds:XRDS>
*/
$content=$response['content'];
$server='';
if (preg_match('/'.preg_quote('<URI>','/').'(.*)'.preg_quote('</URI>','/').'/is', $content, $reg))
{
$server=$reg[1];
}
if (empty($server))
{
$this->ErrorStore('OPENID_NOSERVERSFOUND');
return false;
}
else
{
dol_syslog(get_class($this).'::sendDiscoveryRequestToGetXRDS found endpoint = '.$server);
$this->SetOpenIDServer($server);
return $server;
}
}
}
?>

View File

@ -0,0 +1,65 @@
<?php
/*
* Copyright (C) 2013 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/db/dolidb.class.php
* \brief Class file to manage Dolibarr database access
*/
/**
* Class to manage Dolibarr database access
*/
abstract class DoliDB
{
//! Database handler
public $db;
//! Database type
public $type;
//! Database label
static $label;
//! Charset used to force charset when creating database
public $forcecharset;
//! Collate used to force collate when creating database
public $forcecollate;
//! Min database version
static $versionmin;
//! Resultset of last query
private $_results;
//! 1 if connected, else 0
public $connected;
//! 1 if database selected, else 0
public $database_selected;
//! Selected database name
public $database_name;
//! Database username
public $database_user;
//! >=1 if a transaction is opened, 0 otherwise
public $transaction_opened;
//! Last successful query
public $lastquery;
//! Last failed query
public $lastqueryerror;
//! Last error message
public $lasterror;
//! Last error number
public $lasterrno;
public $ok;
public $error;
}

View File

@ -23,11 +23,12 @@
* \brief Fichier de la classe permettant de gerer une base mssql
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
/**
* Classe de gestion de la database de dolibarr
*/
class DoliDBMssql
class DoliDBMssql extends DoliDB
{
//! Database handler
var $db;

View File

@ -24,11 +24,12 @@
* \brief Class file to manage Dolibarr database access for a Mysql database
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
/**
* Class to manage Dolibarr database access for a Mysql database
*/
class DoliDBMysql
class DoliDBMysql extends DoliDB
{
//! Database handler
var $db;

View File

@ -24,11 +24,12 @@
* \brief Class file to manage Dolibarr database access for a Mysql database
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
/**
* Class to manage Dolibarr database access for a Mysql database
*/
class DoliDBMysqli
class DoliDBMysqli extends DoliDB
{
//! Database handler
var $db;

View File

@ -27,11 +27,12 @@
* \brief Fichier de la classe permettant de gerer une base pgsql
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
/**
* Class to drive a Postgresql database for Dolibarr
*/
class DoliDBPgsql
class DoliDBPgsql extends DoliDB
{
//! Database handler
var $db;
@ -208,7 +209,7 @@ class DoliDBPgsql
}
// tinyint type conversion
$line=str_replace('tinyint','smallint',$line);
$line=preg_replace('/tinyint\(?[0-9]*\)?/','smallint',$line);
// nuke unsigned
$line=preg_replace('/(int\w+|smallint)\s+unsigned/i','\\1',$line);

View File

@ -24,11 +24,12 @@
* \brief Class file to manage Dolibarr database access for a Sqlite database
*/
require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
/**
* Class to manage Dolibarr database access for a Sqlite database
*/
class DoliDBSqlite
class DoliDBSqlite extends DoliDB
{
//! Database handler
var $db;

View File

@ -210,7 +210,7 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
jQuery("#'.$htmlname.'").val(item.value);
// TODO move this to specific request
if (item.states) {
jQuery("#departement_id").html(item.states);
jQuery("#state_id").html(item.states);
}
for (i=0;i<length;i++) {
if (item[fields[i]]) { // If defined
@ -233,12 +233,12 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='',$minLength=2,
{
jQuery("#" + fields[i]).val(ui.item[fields[i]]);
// If we set new country and new state, we need to set a new list of state to allow change
if (ui.item.states && ui.item["departement_id"] != jQuery("#departement_id").value) {
jQuery("#departement_id").html(ui.item.states);
if (ui.item.states && ui.item["state_id"] != jQuery("#state_id").value) {
jQuery("#state_id").html(ui.item.states);
}
}
}
else if (fields[i]=="state_id" || fields[i]=="departement_id")
else if (fields[i]=="state_id" || fields[i]=="state_id")
{
if (ui.item[fields[i]] > 0) // Do not erase state if unknown
{

View File

@ -4,8 +4,9 @@
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
*
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
@ -61,6 +62,15 @@ function societe_prepare_head($object)
$head[$h][2] = 'supplier';
$h++;
}
if (($object->localtax1_assuj || $object->localtax2_assuj) && (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 0) )
{
$head[$h][0] = DOL_URL_ROOT.'/societe/localtaxes.php?socid='.$object->id;
$head[$h][1] = $langs->trans("LocalTaxes");
$head[$h][2] = 'localtaxes';
$h++;
}
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;

View File

@ -8,6 +8,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@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
@ -2868,12 +2869,15 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="")
/**
* Get type and rate of localtaxes for a particular vat rate/country fo thirdparty
* TODO
* This function is called to retrieve type for building PDF. Such call of function must be removed.
* Instead this function must be called when adding a line to get (array of localtax and type) and
* provide it to the function calcul_price_total.
*
* @param real $vatrate VAT Rate
* @param int $local Number of localtax (1 or 2, or 0 to return 1+2)
* @param int $thirdparty company object
* @return array array(Type of local tax (1 to 7 / 0 if not found), rate or amount of localtax)
* @deprecated TODO We should remove this function by storing rate and type into detail lines.
* @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
* @param int $thirdparty Company object
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
*/
function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
{
@ -2882,7 +2886,7 @@ function getLocalTaxesFromRate($vatrate, $local, $thirdparty)
dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local." thirdparty id=".(is_object($thirdparty)?$thirdparty->id:''));
// Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type,t.accountancy_code_sell,t.accountancy_code_buy";
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
$sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'";
$sql .= " AND t.taux = ".$vatrate." AND t.active = 1";
@ -3474,16 +3478,18 @@ function dol_html_entity_decode($a,$b,$c='UTF-8')
/**
* Replace htmlentities functions to manage errors
* http://php.net/manual/en/function.htmlentities.php
*
* @param string $a Operand a
* @param string $b Operand b
* @param string $c Operand c
* @return string String encoded
* @param string $string The input string.
* @param int $flags Flags(see PHP doc above)
* @param string $encoding Encoding
* @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities
* @return string $ret Encoded string
*/
function dol_htmlentities($a,$b,$c='UTF-8')
function dol_htmlentities($string, $flags=null, $encoding='UTF-8', $double_encode=false)
{
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
$ret=@htmlentities($a,$b,$c);
$ret=@htmlentities($string, $flags, $encoding, $double_encode);
return $ret;
}
@ -4433,4 +4439,40 @@ if (! function_exists('getmypid'))
}
}
/**
* Natural search
*
* @param mixed $fields String or array of strings filled with the fields names in the SQL query
* @param string $value The value to look for
* @return string $res The statement to append to the SQL query
*/
function natural_search($fields, $value)
{
global $db;
$crits = explode(' ', $value);
$res = "";
if (! is_array($fields)) {
$fields = array($fields);
}
$end = count($fields);
$end2 = count($crits);
$j = 0;
foreach ($crits as $crit) {
$i = 0;
foreach ($fields as $field) {
if ( $i > 0 && $i < $end){
$res .= " OR ";
}
$res .= $field . " LIKE '%" . $db->escape(trim($crit)) . "%'";
$i++;
}
if ($end > 1) $res .= ')';
if ($j < $end2 - 1) $res .= " AND ";
if ($end > 1 && $j < $end2 - 1) $res .= '(';
$j++;
}
return " AND " . ($end > 1? '(' : '') . $res;
}
?>

View File

@ -549,6 +549,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$maskcounter=$reg[1];
$maskraz=-1;
$maskoffset=0;
$resetEveryMonth=false;
if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter
@ -622,21 +623,32 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
if ($maskraz > 12) return 'ErrorBadMaskBadRazMonth';
// Define posy, posm and reg
if ($maskraz > 1)
if ($maskraz > 1) // if reset is not first month, we need month and year into mask
{
if (! preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode)
&& ! preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask';
if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; }
elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; }
else return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask';
if (dol_strlen($reg[$posy]) < 2) return 'ErrorCantUseRazWithYearOnOneDigit';
}
else
else // if reset is for a specific month in year, we need year
{
if (! preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode)) return 'ErrorCantUseRazIfNoYearInMask';
if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; }
if (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=3; $posm=2; }
else if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=3; }
else if (preg_match('/^(.*)\{(y+)\}/i',$maskwithonlyymcode,$reg)) { $posy=2; $posm=0; }
else return 'ErrorCantUseRazIfNoYearInMask';
}
//print "x".$maskwithonlyymcode." ".$maskraz." ".$posy." ".$posm;
//var_dump($reg);
// Define length
$yearlen = $posy?dol_strlen($reg[$posy]):0;
$monthlen = $posm?dol_strlen($reg[$posm]):0;
// Define pos
$yearpos = (dol_strlen($reg[1])+1);
$monthpos = ($yearpos+$yearlen);
if ($posy == 3 && $posm == 2) { // if month is before year
$monthpos = (dol_strlen($reg[1])+1);
$yearpos = ($monthpos+$monthlen);
}
//print "xxx ".$maskwithonlyymcode." maskraz=".$maskraz." posy=".$posy." yearlen=".$yearlen." yearpos=".$yearpos." posm=".$posm." monthlen=".$monthlen." monthpos=".$monthpos." yearoffsettype=".$yearoffsettype." resetEveryMonth=".$resetEveryMonth."\n";
// Define $yearcomp and $monthcomp (that will be use in the select where to search max number)
$monthcomp=$maskraz;
@ -662,7 +674,6 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
// For backward compatibility
else if (date("m",$date) < $maskraz && empty($resetEveryMonth)) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year
$yearlen = dol_strlen($reg[$posy]);
if ($yearlen == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
elseif ($yearlen == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
elseif ($yearlen == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
@ -671,14 +682,6 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
if ($yearlen == 4) $yearcomp1=sprintf("%04d",date("Y",$date)+$yearoffset+1);
elseif ($yearlen == 2) $yearcomp1=sprintf("%02d",date("y",$date)+$yearoffset+1);
$monthlen = dol_strlen($reg[$posm]);
$yearpos = (dol_strlen($reg[1])+1);
$monthpos = ($yearpos+$yearlen);
if ($posy == 3) {
$monthpos = (dol_strlen($reg[1])+1);
$yearpos = ($monthpos+$monthlen);
}
$sqlwhere.="(";
$sqlwhere.=" (SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$yearcomp."'";
$sqlwhere.=" AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") >= '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."')";
@ -687,20 +690,14 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$sqlwhere.=" AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") < '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."') ";
$sqlwhere.=')';
}
else if($resetEveryMonth) {
$monthlen = dol_strlen($reg[$posm]);
$yearpos = (dol_strlen($reg[1])+1);
$monthpos = ($yearpos+$yearlen);
if ($posy == 3) {
$monthpos = (dol_strlen($reg[1])+1);
$yearpos = ($monthpos+$monthlen);
}
$sqlwhere.=" SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$yearcomp."'";
$sqlwhere.=" AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") = '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."' ";
else if ($resetEveryMonth)
{
$sqlwhere.="(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$yearcomp."'";
$sqlwhere.=" AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") = '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."')";
}
else // reset is done on january
{
$sqlwhere.='(SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).") = '".$yearcomp."')";
$sqlwhere.='(SUBSTRING('.$field.', '.$yearpos.', '.$yearlen.") = '".$yearcomp."')";
}
}
//print "sqlwhere=".$sqlwhere." yearcomp=".$yearcomp."<br>\n"; // sqlwhere and yearcomp defined only if we ask a reset
@ -1451,46 +1448,46 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
// To work with non standard path
if ($objecttype == 'facture' || $objecttype == 'invoice') {
$classpath = 'compta/facture/class';
$module='facture';
$classpath = 'compta/facture/class';
$module='facture';
$subelement='facture';
}
if ($objecttype == 'commande' || $objecttype == 'order') {
$classpath = 'commande/class';
$module='commande';
$classpath = 'commande/class';
$module='commande';
$subelement='commande';
}
if ($objecttype == 'propal') {
$classpath = 'comm/propal/class';
}
if ($objecttype == 'shipping') {
$classpath = 'expedition/class';
$subelement = 'expedition';
$classpath = 'expedition/class';
$subelement = 'expedition';
$module = 'expedition_bon';
}
if ($objecttype == 'delivery') {
$classpath = 'livraison/class';
$subelement = 'livraison';
$classpath = 'livraison/class';
$subelement = 'livraison';
$module = 'livraison_bon';
}
if ($objecttype == 'contract') {
$classpath = 'contrat/class';
$module='contrat';
$classpath = 'contrat/class';
$module='contrat';
$subelement='contrat';
}
if ($objecttype == 'member') {
$classpath = 'adherents/class';
$module='adherent';
$classpath = 'adherents/class';
$module='adherent';
$subelement='adherent';
}
if ($objecttype == 'cabinetmed_cons') {
$classpath = 'cabinetmed/class';
$module='cabinetmed';
$classpath = 'cabinetmed/class';
$module='cabinetmed';
$subelement='cabinetmedcons';
}
if ($objecttype == 'fichinter') {
$classpath = 'fichinter/class';
$module='ficheinter';
$classpath = 'fichinter/class';
$module='ficheinter';
$subelement='fichinter';
}
@ -1498,13 +1495,13 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
$classfile = strtolower($subelement); $classname = ucfirst($subelement);
if ($objecttype == 'invoice_supplier') {
$classfile = 'fournisseur.facture';
$classfile = 'fournisseur.facture';
$classname='FactureFournisseur';
$classpath = 'fourn/class';
$module='fournisseur';
}
if ($objecttype == 'order_supplier') {
$classfile = 'fournisseur.commande';
$classfile = 'fournisseur.commande';
$classname='CommandeFournisseur';
$classpath = 'fourn/class';
$module='fournisseur';

View File

@ -17,20 +17,21 @@
*/
/**
* \file htdocs/core/lib/functions2.lib.php
* \brief A set of functions for Dolibarr
* This file contains all rare functions.
* \file htdocs/core/lib/geturl.lib.php
* \brief This file contains functions dedicated to get URL.
*/
/**
* Function get content from an URL (use proxy if proxy defined)
*
* @param string $url URL to call.
* @param string $postorget 'post' = POST, 'get='GET'
* @param string $param Paraemeters of URL (x=value1&y=value2)
* @return array returns an associtive array containing the response from the server.
* @param string $url URL to call.
* @param string $postorget 'POST', 'GET', 'HEAD'
* @param string $param Paraemeters of URL (x=value1&y=value2)
* @param string $followlocation 1=Follow location, 0=Do not follow
* @param array $addheaders Array of string to add into header. Example: ('Accept: application/xrds+xml', ....)
* @return array Returns an associative array containing the response from the server array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
*/
function getURLContent($url,$postorget='GET',$param='')
function getURLContent($url,$postorget='GET',$param='',$followlocation=1,$addheaders=array())
{
//declaring of global variables
global $conf, $langs;
@ -52,6 +53,11 @@ function getURLContent($url,$postorget='GET',$param='')
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSLVERSION, 3); // Force SSLv3
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, ($followlocation?true:false));
if (count($addheaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $addheaders);
curl_setopt($ch, CURLINFO_HEADER_OUT, true); // To be able to retrieve request header and log it
//turning off the server and peer verification(TrustManager Concept).
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
@ -60,9 +66,21 @@ function getURLContent($url,$postorget='GET',$param='')
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)?5:$conf->global->MAIN_USE_CONNECT_TIMEOUT);
curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT)?30:$conf->global->MAIN_USE_RESPONSE_TIMEOUT);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
if ($postorget == 'POST') curl_setopt($ch, CURLOPT_POST, 1);
else curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // We want response
if ($postorget == 'POST')
{
curl_setopt($ch, CURLOPT_POST, 1); // POST
curl_setopt($ch, CURLOPT_POSTFIELDS, $param); // Setting param x=a&y=z as POST fields
}
else if ($postorget == 'HEAD')
{
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD'); // HTTP request is 'HEAD'
curl_setopt($ch, CURLOPT_NOBODY, true);
}
else
{
curl_setopt($ch, CURLOPT_POST, 0); // GET
}
//if USE_PROXY constant set to TRUE in Constants.php, then only proxy will be enabled.
if ($USE_PROXY)
@ -73,18 +91,18 @@ function getURLContent($url,$postorget='GET',$param='')
if ($PROXY_USER) curl_setopt($ch, CURLOPT_PROXYUSERPWD, $PROXY_USER. ":" . $PROXY_PASS);
}
//setting the nvpreq as POST FIELD to curl
curl_setopt($ch, CURLOPT_POSTFIELDS, $param);
//getting response from server
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
dol_syslog("getURLContent request=".$status);
dol_syslog("getURLContent response=".$response);
$rep=array();
$rep['content']=$response;
$rep['curl_error_no']='';
$rep['curl_error_msg']='';
dol_syslog("getURLContent response=".$response);
if (curl_errno($ch))
{
@ -98,7 +116,7 @@ function getURLContent($url,$postorget='GET',$param='')
{
$info = curl_getinfo($ch);
$rep['header_size']=$info['header_size'];
//closing the curl
curl_close($ch);
}
@ -106,3 +124,4 @@ function getURLContent($url,$postorget='GET',$param='')
return $rep;
}
?>

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -46,6 +46,7 @@
* @param int $info_bits Miscellaneous informations on line
* @param int $type 0/1=Product/service
* @param string $seller Thirdparty seller (we need $seller->country_code property). Provided only if seller is the supplier.
* @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate function)
* @return result[ 0=total_ht,
* 1=total_vat,
* 2=total_ttc,
@ -63,7 +64,7 @@
* 14=amount tax1 for total_ht_without_discount,
* 15=amount tax1 for total_ht_without_discount]
*/
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '')
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '',$localtaxes_array='')
{
global $conf,$mysoc,$db;
@ -71,9 +72,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
// Clean parameters
if (empty($txtva)) $txtva=0;
if (empty($seller) || ! is_object($seller))
{
dol_syslog("calcul_price_total Warning: function is called with parameter seller that is missing", LOG_WARNING);
if (! is_object($mysoc)) // mysoc may be not defined (during migration process)
{
$mysoc=new Societe($db);
@ -82,9 +83,13 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$seller=$mysoc; // If sell is done to a customer, $seller is not provided, we use $mysoc
//var_dump($seller->country_id);exit;
}
if (empty($localtaxes_array) || ! is_array($localtaxes_array))
{
dol_syslog("calcul_price_total Warning: function is called with parameter localtaxes_array that is missing", LOG_WARNING);
}
// Too verbose. Enable for debug only
//dol_syslog("calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate);
$countryid=$seller->country_id;
if ($uselocaltax1_rate < 0) $uselocaltax1_rate=$seller->localtax1_assuj;
if ($uselocaltax2_rate < 0) $uselocaltax2_rate=$seller->localtax2_assuj;
@ -92,26 +97,36 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
// Now we search localtaxes information ourself (rates and types).
$localtax1_type=0;
$localtax2_type=0;
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv";
$sql.= " WHERE cv.taux = ".$txtva;
$sql.= " AND cv.fk_pays = ".$countryid;
dol_syslog("calcul_price_total search vat information sql=".$sql);
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($obj)
{
$localtax1_rate=$obj->localtax1;
$localtax2_rate=$obj->localtax2;
$localtax1_type=$obj->localtax1_type;
$localtax2_type=$obj->localtax2_type;
//var_dump($localtax1_rate.' '.$localtax2_rate.' '.$localtax1_type.' '.$localtax2_type);exit;
}
}
else dol_print_error($db);
if (is_array($localtaxes_array))
{
$localtax1_type = $localtaxes_array[0];
$localtax1_rate = $localtaxes_array[1];
$localtax2_type = $localtaxes_array[2];
$localtax2_rate = $localtaxes_array[3];
}
else
{
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
$sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv";
$sql.= " WHERE cv.taux = ".$txtva;
$sql.= " AND cv.fk_pays = ".$countryid;
dol_syslog("calcul_price_total search vat information sql=".$sql);
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($obj)
{
$localtax1_rate=$obj->localtax1;
$localtax2_rate=$obj->localtax2;
$localtax1_type=$obj->localtax1_type;
$localtax2_type=$obj->localtax2_type;
//var_dump($localtax1_rate.' '.$localtax2_rate.' '.$localtax1_type.' '.$localtax2_type);exit;
}
}
else dol_print_error($db);
}
// initialize total (may be HT or TTC depending on price_base_type)
$tot_sans_remise = $pu * $qty;
$tot_avec_remise_ligne = $tot_sans_remise * (1 - ($remise_percent_ligne / 100));

View File

@ -215,7 +215,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
{
foreach($feature2 as $subfeature)
{
if (empty($user->rights->$feature->$subfeature->creer)
if (empty($user->rights->$feature->$subfeature->creer)
&& empty($user->rights->$feature->$subfeature->write)
&& empty($user->rights->$feature->$subfeature->create)) $createok=0;
else { $createok=1; break; } // For bypass the second test if the first is ok
@ -411,7 +411,8 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
// If external user: Check permission for external users
if ($user->societe_id > 0)
{
$sql = "SELECT dbt.".$dbt_keyfield;
if (empty($dbt_keyfield)) dol_print_error('','Param dbt_keyfield is required but not defined');
$sql = "SELECT dbt.".$dbt_keyfield;
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql.= " WHERE dbt.rowid = ".$objectid;
$sql.= " AND dbt.".$dbt_keyfield." = ".$user->societe_id;
@ -419,6 +420,7 @@ function restrictedArea($user, $features, $objectid=0, $dbtablename='', $feature
// If internal user: Check permission for internal users that are restricted on their objects
else if (! empty($conf->societe->enabled) && ($user->rights->societe->lire && ! $user->rights->societe->client->voir))
{
if (empty($dbt_keyfield)) dol_print_error('','Param dbt_keyfield is required but not defined');
$sql = "SELECT sc.fk_soc";
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";

View File

@ -515,9 +515,23 @@ function quotedPrintEncode($str,$forcal=0)
function quotedPrintDecode($str)
{
$out = preg_replace('/=\r?\n/', '', $str);
$out = preg_replace('/=([A-F0-9]{2})/e', chr(hexdec('\\1')), $out);
/*
* preg_replace /e modifier is deprecated in PHP 5.5
* but anonymous functions for use in preg_replace_callback are only available from 5.3.0
*/
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
$out = preg_replace_callback(
'/=([A-F0-9]{2})/',
function ($m) {
return chr(hexdec($m[1]));
},
$out
);
} else {
$out = preg_replace('/=([A-F0-9]{2})/e', chr(hexdec('\\1')), $out);
}
return trim($out);
}
?>
?>

View File

@ -0,0 +1,116 @@
<?php
/* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/login/functions_openid.php
* \ingroup core
* \brief Authentication functions for OpenId mode
*/
include_once DOL_DOCUMENT_ROOT.'/core/class/openid.class.php';
/**
* Check validity of user/password/entity
* If test is ko, reason must be filled into $_SESSION["dol_loginmesg"]
*
* @param string $usertotest Login
* @param string $passwordtotest Password
* @param int $entitytotest Number of instance (always 1 if module multicompany not enabled)
* @return string Login if OK, '' if KO
*/
function check_user_password_openid($usertotest,$passwordtotest,$entitytotest)
{
global $_POST,$db,$conf,$langs;
dol_syslog("functions_openid::check_user_password_openid usertotest=".$usertotest);
$login='';
// Get identity from user and redirect browser to OpenID Server
if (isset($_POST['username']))
{
$openid = new SimpleOpenID();
$openid->SetIdentity($_POST['username']);
$protocol = ($conf->file->main_force_https ? 'https://' : 'http://');
$openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]);
$openid->SetRequiredFields(array('email','fullname'));
$_SESSION['dol_entity'] = $_POST["entity"];
//$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone'));
if ($openid->sendDiscoveryRequestToGetXRDS())
{
$openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script
$openid->Redirect(); // This will redirect user to OpenID Server
}
else
{
$error = $openid->GetError();
return false;
}
return false;
}
// Perform HTTP Request to OpenID server to validate key
elseif($_GET['openid_mode'] == 'id_res')
{
$openid = new SimpleOpenID();
$openid->SetIdentity($_GET['openid_identity']);
$openid_validation_result = $openid->ValidateWithServer();
if ($openid_validation_result == true)
{
// OK HERE KEY IS VALID
$sql ="SELECT login";
$sql.=" FROM ".MAIN_DB_PREFIX."user";
$sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'";
$sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")";
dol_syslog("functions_openid::check_user_password_openid sql=".$sql);
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
if ($obj)
{
$login=$obj->login;
}
}
}
else if($openid->IsError() == true)
{
// ON THE WAY, WE GOT SOME ERROR
$error = $openid->GetError();
return false;
}
else
{
// Signature Verification Failed
//echo "INVALID AUTHORIZATION";
return false;
}
}
else if ($_GET['openid_mode'] == 'cancel')
{
// User Canceled your Request
//echo "USER CANCELED REQUEST";
return false;
}
return $login;
}
?>

View File

@ -166,14 +166,16 @@ class MenuManager
{
// We add sub entry
print str_pad('',1).'<li data-role="list-divider" class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'">';
print '<a href="'.$relurl.'"';
//print ' data-ajax="false"';
print '>';
print str_pad('',12,'&nbsp;');
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") print $langs->trans("Access"); // No translation
else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
print '</a>';
print '</li>'."\n";
}
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu']
{
$relurl2=dol_buildpath($val2['url'],1);
$relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2);
@ -183,7 +185,12 @@ class MenuManager
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
if ($val2['level']==0) print str_pad('',$val2['level']+1).'<li'.($val2['level']==0?' data-role="list-divider"':'').' class="lilevel'.($val2['level']+1).' ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
else print str_pad('',$val2['level']+1).'<li class="lilevel'.($val2['level']+1).'">'; // ui-btn to highlight on clic
if ($relurl2) print '<a href="'.$relurl2.'">';
if ($relurl2)
{
print '<a href="'.$relurl2.'"';
//print ' data-ajax="false"';
print '>';
}
print str_pad('',($val2['level']+1)*12,'&nbsp;');
print $val2['titre'];
if ($relurl2) print '</a>';

Some files were not shown because too many files have changed in this diff Show More